
/* A Bison parser, made by GNU Bison 2.4.1.  */

/* Skeleton implementation for Bison's Yacc-like parsers in C
   
      Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
   Free Software Foundation, Inc.
   
   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation, either version 3 of the License, or
   (at your option) any later version.
   
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
   
   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */

/* As a special exception, you may create a larger work that contains
   part or all of the Bison parser skeleton and distribute that work
   under terms of your choice, so long as that work isn't itself a
   parser generator using the skeleton or a modified version thereof
   as a parser skeleton.  Alternatively, if you modify or redistribute
   the parser skeleton itself, you may (at your option) remove this
   special exception, which will cause the skeleton and the resulting
   Bison output files to be licensed under the GNU General Public
   License without this special exception.
   
   This special exception was added by the Free Software Foundation in
   version 2.2 of Bison.  */

/* C LALR(1) parser skeleton written by Richard Stallman, by
   simplifying the original so-called "semantic" parser.  */

/* All symbols defined below should begin with yy or YY, to avoid
   infringing on user name space.  This should be done even for local
   variables, as they might otherwise be expanded by user macros.
   There are some unavoidable exceptions within include files to
   define necessary library symbols; they are noted "INFRINGES ON
   USER NAME SPACE" below.  */

/* Identify Bison output.  */
#define YYBISON 1

/* Bison version.  */
#define YYBISON_VERSION "2.4.1"

/* Skeleton name.  */
#define YYSKELETON_NAME "yacc.c"

/* Pure parsers.  */
#define YYPURE 0

/* Push parsers.  */
#define YYPUSH 0

/* Pull parsers.  */
#define YYPULL 1

/* Using locations.  */
#define YYLSP_NEEDED 0



/* Copy the first part of user declarations.  */

/* Line 189 of yacc.c  */
#line 1 "coolinary.y"

#include <stdio.h>
#include <string.h>
#include "table.h"
#include "coolinary.h"
#include "vegetables.h"
#include "meats.h"
#include "grains.h"
#include "fruits.h"
#define NSIZE 1094
#define TSIZE  512

static table symboltable;
static table nutritiontable;

extern FILE* yyin;


	/* called before the parsing - loads food values into the nutrition table and creates the symbol table */

void coolinary_init(void) {

       nutritiontable = table_init(NSIZE);
	
	addFruits(&nutritiontable);
	addMeats(&nutritiontable);
	addVeggies(&nutritiontable);
	addGrains(&nutritiontable);
	
	symboltable = table_init(TSIZE);
	
}

void yyerror(const char *str) { fprintf(stderr,"error: %s\n",str); }

/*_____________________________________________new structs in coolinary.h_____________________________________________*/

/*_____________________________________________execute______________________________________________________________*/

	/*function that executes all of the statments in a statement list.  Called by program or by a control statement*/

	void execute (struct statement_list stmt_list) {
		int i=0;
		/*all functions are void with 1 parameter - of type struct params_list - so the call is the same*/
		for (i;i<stmt_list.num_statements;i++) {
			stmt_list.s_list[i].fpointer (stmt_list.s_list[i].p_list);
		}
	}

/*_____________________________________________helper functions________________________________________________*/
	
	/*converts a list of ids (strings) to a list of params */
	/*doesn't do any type checking*/

	struct param_list ids_to_params (struct id_list ids)
	{
		
		/*allocate space*/	
		struct param_list *new = (struct param_list*) malloc (sizeof (struct param_list));

		/*"convert" from strings to addresses*/
		int i = 0;
		for (i;i<ids.num_ids;i++) {
			new->list[i].value = (long) ids.list[i];
		}

		/*set number*/
		new->num_params = ids.num_ids;

		/*maybe should return a pointer instead?*/
		return *new;
	}

	/*gets an address from a variable in the symbol table.  rh_address is a void pointer addr and an int size.  the second parameter is the typename - 
	this will test for whether the retrieved item is of the same type - and if not give an error*/

	rh_address* get_address_size (char* name, int typename, int typename2)
	{
		lookup_result *tl = table_includes(symboltable, name);

		if (tl->index == -1) {
			yyerror("Compile-Time Error");
			printf("Variable %s is not declared before use.\n", name);
			exit(-1);
		}
		else if (tl->type != typename && tl->type != typename2) {
			yyerror("Compile-Time Error");
			printf("Type mismatch with regards to variable %s.\n", name);
			exit(-1);
		}

		return table_retrieve (symboltable, tl->index);
	}

	/*gets the type for a variable from the symbol table - returned as an int enum
	gives an error if it doesn't exist*/

	int get_type (char* name) {
		lookup_result *tl = table_includes(symboltable, name);

		if (tl->index == -1) {
			yyerror("Compile-Time Error");
			printf("Variable %s is not defined before use.\n", name);
			exit(-1);
		}

		return tl->type;
	}

	/*returns a string representing an integer*/

	char* itoa (int a) 
	{
		int length = 1;
		int i, count;


		{for (i=10;((i-.01) < a);i*=10,length++);}

		char* new = (char*) malloc (length+1);

		for (count = 0, i /= 10; count<length;count++,i/=10) {
			*(new + count) = (a / i) + 48;
			a -= (a / i) * i;
		}

		*(new + length) = '\0';

		return new;
	}

	float power (float a, int b) 
	{
		int i = 0;
		float total = 1;
		for (i;i<b;i++) {
			total *= a;
		}

		return total;
	}
				
		
				

/*_____________________________________________expression functions_______________________________________________*/

	/* evaluates an arithmetric function all od these have two operands - which may be variables or may be accessors - or may be values
	They cannot themselves be arithmetic functions*/
	
	int int_evaluate (struct param_list params, int op) {
		int vals[2];
		int i = 0;
		int v_type;

		/*idea is to reduce the parameter to an int value - then perform the requested operation on the int values - which are stored in the vals array
		if it is a valid string concat operation - it comes here - but we return zero.  
		otherwise if it isn't an integer type this gives an error */

		for (i = 0; i<2; i++) {
			if (params.list[i].is_name) {
				v_type = get_type ((char*) params.list[i].value);

				/*could be be string concat*/
				if (i == 0 && v_type == CSTRING) {return -1;}

				/*error*/
				else if (v_type != INTEGER) {
					yyerror ("Coolinary binary operators are limited to integer types.\n");
					exit (-1);
				}

				rh_address* temp = get_address_size ((char*) params.list[i].value, INTEGER, -1);
				vals[i] = *((int*) temp->addr);
			}
			else if (params.list[i].is_accsr) {
				struct param_list *accsr = (struct param_list*) params.list[i].value;
				
				/*could be string concat*/
				if (i==0 && accsr->list[1].value == FNAME) {
					return -1;
				}
				else {
					rh_address *rh_addr = get_address_size ((char*) accsr->list[0].value, FGROUP, -1);
					switch (accsr->list[1].value) {
						case FNAME:  yyerror ("name cannot be used as an operand in an integer context"); exit(-1); break;
						case FQUANTITY: vals[i] = ((cooltype *) rh_addr->addr)->quantity; break;
						case FNUTRITION: vals[i] = ((cooltype *) rh_addr->addr)->nutrition; break;
						case FTIME: vals[i] = ((cooltype *) rh_addr->addr)->time; break;			
					}
				}
			}
				
			else {
				/*test for possible string concat*/
				if (i == 0 && params.list[0].type == CSTRING) {return -1;}
				else if (params.list[i].type != INTEGER) {
					yyerror ("Coolinary binary operators are limited to integer types.\n");
					exit (-1);
				}
				vals[i] = params.list[i].value;
			}
		}

		switch (op) {
			case ADD: return (vals[0] + vals[1]); break;
			case SUBTRACT: return (vals[0] - vals[1]); break;
			case MULTIPLY: return (vals[0] * vals[1]); break;
			case DIVIDE: return (vals[0] / vals[1]); break;
			case LTHAN: return (vals[0] < vals[1]); break;
			case LTHANE: return (vals[0] <= vals[1]); break;
			case EQUALS: return (vals[0] == vals[1]); break;
			case NEQUALS: return (vals[0] != vals[1]); break;
			case GTHANE: return (vals[0] >= vals[1]); break;
			case GTHAN: return (vals[0] > vals[1]); break;
		}
	}

	/*this is called when an arithmetric expression only contains literals - the idea is to evaluate it once instead of each time
	in a control setting.  both operands are ints - so you just switch on the operation*/

	int short_int_evaluate (int a, int b, int op) {
		switch (op) {
			case ADD: return (a + b); break;
			case SUBTRACT: return (a - b); break;
			case MULTIPLY: return (a * b); break;
			case DIVIDE: return (a / b); break;
			case LTHAN: return (a < b); break;
			case LTHANE: return (a <= b); break;
			case EQUALS: return (a == b); break;
			case NEQUALS: return (a != b); break;
			case GTHANE: return (a >= b); break;
			case GTHAN: return (a > b); break;
		}
	}

	/*this is the equivalient of the short_int_evaluation for concatenation*/

	char* short_concatanate (char* a, char* b) {
		/*safe way to avoid overwriting anything*/
		int length = strlen(a) + strlen(b) + 2;
		char *new = (char*) malloc (length);

		memcpy (new,a,strlen(a));
		*(new+strlen(a)) = ' ';
		memcpy (new+strlen(a)+1,b,strlen(b));
		*(new+length-1)= '\0';
		return new;
	}

	/*first operand can be a string literal, string accessor, or string variable.  Second can be any of these or in int expression as well
	Adds the two together with a space in the middle and returns a pointer to this.  appraoch is to get the two sting values into vals[2]
	and then do the concat on them*/

	char* concatanate (struct param_list params) {
		char* vals[2];
				
		/* first param can be string literal or string var or name accessor */
		if (params.list[0].is_name) {
			vals[0] = (char*) get_address_size((char*) params.list[0].value, CSTRING, -1)->addr;
		}
		else if (params.list[0].is_accsr) {
			struct param_list *accsr = (struct param_list*) params.list[0].value;
			if (accsr->list[1].value != FNAME) {yyerror("First operand to string concatenation must be of type string");exit(-1);}
			else {vals[0] = ((cooltype*) get_address_size((char*) accsr->list[0].value, FGROUP, -1)->addr)->name;}
		}			
		else {
			vals[0] = (char*) params.list[0].value;
		}

		/*second param can be string literal or int literal or int var or string var or string or int accessor*/
		if (params.list[1].is_name) {
			int type = get_type ((char*) params.list[1].value);
			switch (type) {
				case CSTRING: vals[1] = (char*) get_address_size((char*) params.list[1].value, CSTRING, -1)->addr; break;
				case INTEGER: vals[1] = itoa (*( (long*) get_address_size((char*) params.list[1].value, INTEGER, -1)->addr)); break;
				default:  yyerror ("Invalid type for + operator.\n"); exit(-1); break;
			}
		}
		else if (params.list[1].is_accsr) {
			struct param_list *accsr = (struct param_list*) params.list[1].value;
			switch (accsr->list[1].value) {
				case FNAME: vals[1] = ((cooltype*) get_address_size((char*) accsr->list[0].value, FGROUP, -1)->addr)->name; break;
				case FQUANTITY: vals[1] = itoa(((cooltype*) get_address_size((char*) accsr->list[0].value, FGROUP, -1)->addr)->quantity); break;
				case FNUTRITION: vals[1] = itoa(((cooltype*) get_address_size((char*) accsr->list[0].value, FGROUP, -1)->addr)->nutrition); break;
				case FTIME: vals[1] = itoa(((cooltype*) get_address_size((char*) accsr->list[0].value, FGROUP, -1)->addr)->time); break;				
			}
		}
		else {
			switch (params.list[1].type) {
				case CSTRING: vals[1] = (char*) params.list[1].value; break;
				case INTEGER:	vals[1] = itoa(params.list[1].value); break;
				default: yyerror ("Illegal type in + expression.\n"); exit (-1); break;
			}
		}

		/*concat the strings*/
		return short_concatanate (vals[0], vals[1]);
	}
			


		

/*______________________________________________statement functions____________________________________________*/

	/* function to declare ints.  takes a list of ids - and loops through them.  Will give an error either if the function is already in the symbol table.  
	input is an array of id names*/

	void int_declare (struct param_list params) {
		int i = 0;
		for (i;i<params.num_params;i++) {
			if( table_includes(symboltable, (char*) params.list[i].value)->index == -1) {
				int* temp = (int*) malloc (sizeof (int));
				table_insert(symboltable, (char*) params.list[i].value, INTEGER, (void*) temp, sizeof(int));
				free (temp);
			}
			else {
				yyerror("Compile-Time Error");
				printf("Variable %s already defined.\n", (char*) params.list[i].value);
				exit(-1);
			}
		}
	}

	/*same as ints just for strings*/

	void string_declare (struct param_list params) 
	{
		int i = 0;
		for (i;i<params.num_params;i++) {
			if( table_includes(symboltable, (char*) params.list[i].value)->index == -1) {
				char* temp = (char*) malloc (1);
				*temp = '\0';
				table_insert(symboltable, (char*) params.list[i].value, CSTRING, (void*) temp, 1);
				free (temp);
			}
			else {
				yyerror("Compile-Time Error");
				printf("Variable %s already defined.\n", (char*) params.list[i].value);
				exit(-1);
			}
		}
	}

	/*slightly more involved.  Here we retrieve the food group information from the nutritiontable first.  then we set the name to 
	id, and then add to the symbol table.  the param_list contains the id's - and then the last entry is the name of the food group.*/ 

	void fgroup_declare (struct param_list params)
	{ 
		int i;
		char* name = (char*) params.list[params.num_params-1].value;

		for (i = 0;i<params.num_params - 1;i++) {
			if( table_includes(symboltable, (char*) params.list[i].value)->index == -1) {
				/*get a pointer to the defined type with the right name */
				rh_address *temp = table_retrieve(nutritiontable, table_includes(nutritiontable, name)->index);
				cooltype *c_temp = (cooltype*) temp->addr;
				
				/*this changes the name in the nutritiontable - but I don't really care*/
				c_temp->name = (char*) params.list[i].value;

				table_insert(symboltable, (char*) params.list[i].value, FGROUP, (void*) c_temp, sizeof (cooltype));
			}
			else {
				yyerror("Compile-Time Error");
				printf("Variable %s already defined.\n", (char*) params.list[i].value);
				exit(-1);
			}
		}
	}

	void user_declare (struct param_list params)
	{
		/*nine params - 1st is new var - 2nd is the existing one that its most like*/
		
		if ( table_includes(symboltable, (char*) params.list[0].value)->index == -1) {
			/*this shouldn't be called rh_address but this gets the name of the nutrition type that the new type is most like
			*/

			/*test for whether the requested type exists*/
			if (! strncmp ((char*) params.list[1].value, "water", 5)||
			    ! strncmp ((char*) params.list[1].value, "liquid", 7)||
			    ! strncmp ((char*) params.list[1].value, "dairy", 5)||
			    ! strncmp ((char*) params.list[1].value, "meat", 4)||
			    ! strncmp ((char*) params.list[1].value, "vegetable", 9)||
			    ! strncmp ((char*) params.list[1].value, "fruit", 5)
			) {}
			else {
				yyerror ("you must enter a valid type to create your own food group"); exit(-1);
			}
			
			/*in theory we get cooking parameter values for the new type from this type - but these don't exist yet */

			/*create new struct*/
			cooltype *new = (cooltype*) malloc (sizeof (cooltype));
			
			/*assign values */
			new->name = (char*) params.list[0].value;
			new->nutrition = (float) params.list[2].value;
			new->quantity = 1;
			new->time = 0;
			new->type = (char*)  params.list[1].value;
			new->nutrition_values.calories = (float) params.list[3].value;
			new->nutrition_values.protein = (float) params.list[4].value;
			new->nutrition_values.sugar = (float) params.list[5].value;
			new->nutrition_values.fat = (float) params.list[6].value;
			new->nutrition_values.cholesterol = (float) params.list[7].value;
			new->nutrition_values.vitamin_a = (float) params.list[8].value;
			new->nutrition_values.vitamin_c = (float) params.list[9].value;
		

			/*add the new type to the symbol table*/
			table_insert(symboltable, (char*) params.list[0].value, FGROUP, (void*) new, sizeof (cooltype));

			/*might cause problems*/
			free(new);
			}
		else {
			yyerror("Compile-Time Error");
			printf("Variable %s already defined.\n", (char*) params.list[0].value);
			exit(-1);
		}
	}

	/*same as string or int*/
	void mix_declare (struct param_list params) 
	{
		int i = 0;
		for (i;i<params.num_params;i++) {
			if( table_includes(symboltable, (char*) params.list[i].value)->index == -1) {
				struct mixture *temp = (struct mixture*) malloc (sizeof (struct mixture));
				temp ->name = (char*) params.list[i].value;
				table_insert(symboltable, (char*) params.list[i].value, MIXTYPE, (void*) temp, 1);
				free (temp);
			}
			else {
				yyerror("Compile-Time Error");
				printf("Variable %s already defined.\n", (char*) params.list[i].value);
				exit(-1);
			}
		}
	}


			



















		 

	/*the param_list has two parameters.  The first is the ID name to assign to - and the second is the thing to assign to it
	this could be either a literal, a name, an operation, or an accessor.  what it is can be determined with .is_name, .is_addr and .is_expr fields */

	void assign (struct param_list params)
	{
		/*first checks the type of the left side - and checks that it is a valid location*/
		int lh_type = get_type((char*) params.list[0].value);
		int rh;
		struct expression* expr;
			
		/*get the rh value*/
		/*as of now - if it's an expression - then it can only be an int - can't assign a string concat to a string */
		if (params.list[1].is_expr) {
			switch (lh_type) {
				case INTEGER: expr = (struct expression*) params.list[1].value;
						rh = int_evaluate (expr->p_list, expr->op);

						/*tried to assign a string concat*/
						if (rh == -1) {
							yyerror ("string concatanations cannot be assigned to ints\n");
							exit (-1);
						}

						table_assign (symboltable, (char*) params.list[0].value, &rh, sizeof(int)); break;

				case CSTRING: yyerror ("compile-time error.  only string variables or string literals may be assigned to strings.\n");
						exit (-1);
						break;
			}
		}
		else if (params.list[1].is_accsr) {
			struct param_list *accsr = (struct param_list*) params.list[1].value;
			switch (accsr->list[1].value) {
				case FNAME:	if (lh_type != CSTRING) {yyerror ("Can't assign a name to an int"); exit(-1);}
						else {
							struct rh_address *rh_addr = get_address_size ((char*) accsr->list[0].value, FGROUP, -1);
							table_assign (symboltable, (char*) params.list[0].value, ((cooltype *) rh_addr->addr)->name, strlen (((cooltype *) rh_addr->addr)->name));
						} break;
				case FQUANTITY:   	if (lh_type != INTEGER) {yyerror ("Can't assign quantity to non-int variable"); exit(-1);}
							else {
								struct rh_address *rh_addr = get_address_size ((char*) accsr->list[0].value, FGROUP, -1);
								table_assign (symboltable, (char*) params.list[0].value, &((cooltype *) rh_addr->addr)->quantity, sizeof (int));
							} break;	
				case FNUTRITION:	if (lh_type != INTEGER) {yyerror ("Can't assign quantity to non-int variable"); exit(-1);}
							else {
								struct rh_address *rh_addr = get_address_size ((char*) accsr->list[0].value, FGROUP, -1);
								table_assign (symboltable, (char*) params.list[0].value, &((cooltype *) rh_addr->addr)->nutrition, sizeof (int));
							} break;
				case FTIME:		if (lh_type != INTEGER) {yyerror ("Can't assign quantity to non-int variable"); exit(-1);}
							else {
								struct rh_address *rh_addr = get_address_size ((char*) accsr->list[0].value, FGROUP, -1);
								table_assign (symboltable, (char*) params.list[0].value, &((cooltype *) rh_addr->addr)->time, sizeof (int));
							} break;
			}
		}
		
		/*so this is a variable that has to agree*/
		else if (params.list[1].is_name) {	
			rh_address* rh_addr = get_address_size ((char*) params.list[1].value, lh_type, -1);
			switch (lh_type) {
				case INTEGER:  table_assign (symboltable, (char*) params.list[0].value, rh_addr->addr, rh_addr->size); break;
				case CSTRING:	 table_assign (symboltable, (char*) params.list[0].value, rh_addr->addr, rh_addr->size); break;
			}	
		}
			
		/*a literal - again - types have to agree*/
		else {
			if (lh_type != params.list[1].type) {
				yyerror("Compile-Time Error");
				printf("Type mismatch with regards to variable %s.\n", (char*) params.list[0].value);
				exit(-1);
			}
			else {
				switch (lh_type) {
					case INTEGER:  table_assign (symboltable, (char*) params.list[0].value, &params.list[1].value, sizeof(int)); break;
					case CSTRING:	 table_assign (symboltable, (char*) params.list[0].value, (char*) params.list[1].value, strlen((char*) params.list[1].value)); break;
				}
			}
		}
	}

	/*special case of assignment - this is the only method that can be assigned to - only takes an int and doesn't take an arithmetric expression*/

	void assign_quantity (struct param_list params)
	{
		/*get the lh_address*/
		rh_address *rh_addr = get_address_size ((char*) params.list[0].value, FGROUP, -1);
		int* q_addr = &((cooltype*) rh_addr->addr)->quantity;

		/*get the rh value */
		if (params.list[1].is_name) {
			rh_address* rh_addr = get_address_size ((char*) params.list[1].value, INTEGER, -1);
			*q_addr = *( (int*) rh_addr->addr);
		}
		else if (params.list[1].is_accsr) {
			struct param_list *accsr = (struct param_list*) params.list[1].value;
			rh_address* rh_addr = get_address_size ((char*) accsr->list[0].value, FGROUP, -1);
			switch (accsr->list[1].value) {
				case FNAME: yyerror("cannot assign a string variable to quantity field"); exit (-1); break;
				case FQUANTITY:  *q_addr = ((cooltype*) rh_addr->addr)->quantity; break;
				case FNUTRITION:  *q_addr = ((cooltype*) rh_addr->addr)->nutrition; break;
				case FTIME: *q_addr = ((cooltype*) rh_addr->addr)->time; break;				
			}

			}
		else {
			*q_addr = params.list[1].value;
		}
	}

	
	/*the first param is the condition - which might be a basic and might be an expression.  The second
	is a pointer to the statement list */

	void simple_if (struct param_list params)
	{
		char truth;

		/*get the value of the condition*/
		if (params.list[0].is_expr) {
			struct expression* temp = (struct expression*) params.list[0].value;
			truth = int_evaluate (temp->p_list, temp->op);
		}
		else {
			truth = params.list[0].value;
		}

		/*error if string expression*/
		if (truth == -1) {
			yyerror ("string expressions cannot be used conditionals\n");
			exit (-1);
		}

		/*call execute on the list of statements */
		if (truth) {
			struct statement_list* temp = (struct statement_list*) params.list[1].value;
			execute (*temp);
		}
	}
	
	/*third parameter in list is the else statements list - otherwise the same as above*/	
	void if_then_else (struct param_list params) {
		char truth;

		/*get the value of the condition*/
		if (params.list[0].is_expr) {
			struct expression* temp = (struct expression*) params.list[0].value;
			truth = int_evaluate (temp->p_list, temp->op);
		}

		else {
			truth = params.list[0].value;
		}

		/*error if string expression*/
		if (truth == -1) {
			yyerror ("string expressions cannot be used as conditionals\n");
			exit (-1);
		}

		/*call execute on the list of statements */
		if (truth) {
			struct statement_list* temp = (struct statement_list*) params.list[1].value;
			execute (*temp);
		}
		/*or on the other list of statements*/
		else {
			struct statement_list* temp = (struct statement_list*) params.list[2].value;
			execute (*temp);
		}
	}

	/*same as the simple_if except that it's inside a loop and retests every time */
	void while_loop (struct param_list params) {
		char truth = 1;

		while (truth) {
		
			/*get the value of the condition*/
			if (params.list[0].is_expr) {
				struct expression* temp = (struct expression*) params.list[0].value;
				truth = int_evaluate (temp->p_list, temp->op);
			}

			else {
				truth = params.list[0].value;
			}

			/*error if string expression*/
			if (truth == -1) {
				yyerror ("string expressions cannot be used as conditionals\n");
				exit (-1);
			}


			/*call execute on the list of statements */
			if (truth) {
				struct statement_list* temp = (struct statement_list*) params.list[1].value;
				execute (*temp);
			}
		}
	}

	/*first param could be value or address - second param is the execution list -  form of a loop that does something a set number of times - doesn't reevaluate*/
	void repeat_loop (struct param_list params) {
		int num_times;
		int i=0;

		/*this inherently tests that it is an int*/
		if (params.list[0].is_name) {
			struct rh_address *rh_addr = get_address_size ((char*) params.list[0].value, INTEGER, -1);
			num_times = *((int*) rh_addr->addr);	
		}
		else if (params.list[0].is_accsr) {
			struct param_list *accsr = (struct param_list*) params.list[0].value;
			rh_address *rh_addr = get_address_size ((char*) accsr->list[0].value, FGROUP, -1);
			switch (accsr->list[1].value) {
				case FNAME:	yyerror ("repeat statement takes int, not string"); exit(-1);break;
				case FQUANTITY:	num_times = ((cooltype *) rh_addr->addr)->quantity; break;
				case FNUTRITION:	num_times = ((cooltype *) rh_addr->addr)->nutrition; break;
				case FTIME:		num_times = ((cooltype *) rh_addr->addr)->time; break;
			}
		}			
		else {
			num_times = params.list[0].value;
		}

		for (i;i<num_times;i++) {
			struct statement_list* temp = (struct statement_list*) params.list[1].value;
			execute (*temp);
		}
	}

	/*prints a string, string variable, string accessor, or a print concat expression*/

	void print (struct param_list params) {
		if (params.list[0].is_expr) {
			struct expression *expr = (struct expression*) params.list[0].value;
			int ev = int_evaluate (expr->p_list, expr->op);

			/*wasn't string concat*/
			if (ev != -1) {
				yyerror ("print only takes string or string expressions.\n");
				exit (-1);
			}
			/*might be string concat - second type still need checked*/
			else {
				char *to_print = concatanate (expr->p_list);
				printf ("%s\n", to_print);
			}
		}
		else if (params.list[0].is_accsr) {
			struct param_list *tlist = (struct param_list*) params.list[0].value;
			
			if (tlist->list[1].value != FNAME) {yyerror ("accessors other than name may not be printed in this fashion"); exit(-1);}

			struct rh_address *rh_addr = get_address_size ((char*) tlist->list[0].value, FGROUP, -1);
			printf ("%s\n", ((cooltype*) rh_addr->addr)->name);
		}	
		else if (params.list[0].is_name) {
			struct rh_address *rh_addr = get_address_size ((char*) params.list[0].value, CSTRING, -1);
			printf ("%s\n", (char*) rh_addr->addr);
			}
		else {
			printf ("%s\n", (char*) params.list[0].value);
		}
	}

	/*cooking functions*/
	int bake (cooltype* object, int minutes)
	{
		char* f_type = object->type;

		if (!strncmp (f_type,"water",5)) {
			return object->quantity;
		}
		else if (!strncmp (f_type,"liquid",6)) {
			return object->quantity;
		}
		else if (!strncmp (f_type,"dairy",5)) {
			return object->quantity;
		}
		else if (!strncmp (f_type,"fruit",5)) {
			int threshold = 15;
			float b_factor = 1.025;
			float a_factor = .95;

			int total_time = minutes + object->time;
			int before = (total_time > threshold) ? threshold : total_time;
			int after = (total_time > threshold) ? total_time - threshold : 0;

			float temp = object->nutrition;
			temp *= power (b_factor, before);
			temp *= power (a_factor, after);
			object->nutrition = (int) temp;

			object->time += minutes;
		}
		else if (!strncmp (f_type,"grain",5)) {
			int threshold = 40;
			float b_factor = 1.125;
			float a_factor = .975;

			int total_time = minutes + object->time;
			int before = (total_time > threshold) ? threshold : total_time;
			int after = (total_time > threshold) ? total_time - threshold : 0;

			float temp = object->nutrition;
			temp *= power (b_factor, before);
			temp *= power (a_factor, after);
			object->nutrition = (int) temp;

			object->time += minutes;
		}
		else if (!strncmp (f_type,"vegetable",9)) {
			int threshold = 40;
			float b_factor = 1.015;
			float a_factor = .95;

			int total_time = minutes + object->time;
			int before = (total_time > threshold) ? threshold : total_time;
			int after = (total_time > threshold) ? total_time - threshold : 0;

			float temp = object->nutrition;
			temp *= power (b_factor, before);
			temp *= power (a_factor, after);
			object->nutrition = (int) temp;

			object->time += minutes;
		}
		else if (!strncmp (f_type,"meat",4)) {
			int threshold = 50;
			float b_factor = 1.15;
			float a_factor = .95;

			int total_time = minutes + object->time;
			int before = (total_time > threshold) ? threshold : total_time;
			int after = (total_time > threshold) ? total_time - threshold : 0;

			float temp = object->nutrition;
			temp *= power (b_factor, before);
			temp *= power (a_factor, after);
			object->nutrition = (int) temp;

			object->time += minutes;
		}

		return 0;
	}

	int boil (cooltype* object, int minutes) 
	{
		char* f_type = object->type;

		if (!strncmp (f_type,"water",5)) {
			int threshold = 3;
			float b_factor = 1.005;
			float a_factor = .99;

			int total_time = minutes + object->time;
			int before = (total_time > threshold) ? threshold : total_time;
			int after = (total_time > threshold) ? total_time - threshold : 0;

			float temp = object->nutrition;
			temp *= power (b_factor, before);
			temp *= power (a_factor, after);
			object->nutrition = (int) temp;

			object->time += minutes;
		}
		else if (!strncmp (f_type,"liquid",6)) {
			int threshold = 5;
			float b_factor = 1.005;
			float a_factor = .99;

			int total_time = minutes + object->time;
			int before = (total_time > threshold) ? threshold : total_time;
			int after = (total_time > threshold) ? total_time - threshold : 0;

			float temp = object->nutrition;
			temp *= power (b_factor, before);
			temp *= power (a_factor, after);
			object->nutrition = (int) temp;

			object->time += minutes;
		}
		else if (!strncmp (f_type,"dairy",5)) {
			int threshold = 5;
			float b_factor = 1;
			float a_factor = .985;

			int total_time = minutes + object->time;
			int before = (total_time > threshold) ? threshold : total_time;
			int after = (total_time > threshold) ? total_time - threshold : 0;

			float temp = object->nutrition;
			temp *= power (b_factor, before);
			temp *= power (a_factor, after);
			object->nutrition = (int) temp;

			object->time += minutes;
		}
		else if (!strncmp (f_type,"fruit",5)) {
			return object->quantity;
		}
		else if (!strncmp (f_type,"grain",5)) {
			return object->quantity;
		}
		else if (!strncmp (f_type,"vegetable",9)) {
			return object->quantity;
		}
		else if (!strncmp (f_type,"meat",4)) {
			return object->quantity;
		}

		return 0;
	}

	int grill (cooltype* object, int minutes) 
	{
		char* f_type = object->type;

		if (!strncmp (f_type,"water",5)) {
			return object->quantity;
		}
		else if (!strncmp (f_type,"liquid",6)) {
			return object->quantity;
		}
		else if (!strncmp (f_type,"dairy",5)) {
			return object->quantity;
		}
		else if (!strncmp (f_type,"fruit",5)) {
			return object->quantity;
		}
		else if (!strncmp (f_type,"grain",5)) {
			return object->quantity;
		}
		else if (!strncmp (f_type,"vegetable",9)) {
			int threshold = 5;
			float b_factor = 1.005;
			float a_factor = .96;

			int total_time = minutes + object->time;
			int before = (total_time > threshold) ? threshold : total_time;
			int after = (total_time > threshold) ? total_time - threshold : 0;

			float temp = object->nutrition;
			temp *= power (b_factor, before);
			temp *= power (a_factor, after);
			object->nutrition = (int) temp;

			object->time += minutes;
		}
		else if (!strncmp (f_type,"meat",4)) {
			int threshold = 10;
			float b_factor = 1.04;
			float a_factor = .975;

			int total_time = minutes + object->time;
			int before = (total_time > threshold) ? threshold : total_time;
			int after = (total_time > threshold) ? total_time - threshold : 0;

			float temp = object->nutrition;
			temp *= power (b_factor, before);
			temp *= power (a_factor, after);
			object->nutrition = (int) temp;

			object->time += minutes;
		}

		return 0;
	}	

	int fry (cooltype* object, int minutes) 
	{
		char* f_type = object->type;

		if (!strncmp (f_type,"water",5)) {
			return object->quantity;
		}
		else if (!strncmp (f_type,"liquid",6)) {
			return object->quantity;
		}
		else if (!strncmp (f_type,"dairy",5)) {
			return object->quantity;
		}
		else if (!strncmp (f_type,"fruit",5)) {
			int threshold = 4;
			float b_factor = 1.00;
			float a_factor = .95;

			int total_time = minutes + object->time;
			int before = (total_time > threshold) ? threshold : total_time;
			int after = (total_time > threshold) ? total_time - threshold : 0;

			float temp = object->nutrition;
			temp *= power (b_factor, before);
			temp *= power (a_factor, after);
			object->nutrition = (int) temp;

			object->time += minutes;
			object->nutrition_values.fat++;
		}
		else if (!strncmp (f_type,"grain",5)) {
			int threshold = 10;
			float b_factor = 1.00;
			float a_factor = .975;

			int total_time = minutes + object->time;
			int before = (total_time > threshold) ? threshold : total_time;
			int after = (total_time > threshold) ? total_time - threshold : 0;

			float temp = object->nutrition;
			temp *= power (b_factor, before);
			temp *= power (a_factor, after);
			object->nutrition = (int) temp;

			object->time += minutes;
			object->nutrition_values.fat++;		
		}
		else if (!strncmp (f_type,"vegetable",9)) {
			int threshold = 10;
			float b_factor = 1.01;
			float a_factor = .975;

			int total_time = minutes + object->time;
			int before = (total_time > threshold) ? threshold : total_time;
			int after = (total_time > threshold) ? total_time - threshold : 0;

			float temp = object->nutrition;
			temp *= power (b_factor, before);
			temp *= power (a_factor, after);
			object->nutrition = (int) temp;

			object->time += minutes;
			object->nutrition_values.fat++;
		}
		else if (!strncmp (f_type,"meat",4)) {
			int threshold = 10;
			float b_factor = 1.00;
			float a_factor = .95;

			int total_time = minutes + object->time;
			int before = (total_time > threshold) ? threshold : total_time;
			int after = (total_time > threshold) ? total_time - threshold : 0;

			float temp = object->nutrition;
			temp *= power (b_factor, before);
			temp *= power (a_factor, after);
			object->nutrition = (int) temp;

			object->time += minutes;
			object->nutrition_values.fat+=1.5;
		}

		return 0;
	}

	void mix_bake (struct mixture* object, int minutes) 
	{
		int i = 0, total=0;
		float bad = 0;
		for (i; i < object->num_items;i++) {
			bad += bake(object->list[i], minutes);
			total += object->list[i]->quantity;
		}

		float ratio = bad / total;

		if (ratio > .33) {
			yyerror ("bake is not valid on this operation"); exit (-1);
		}
	}

	void mix_boil (struct mixture* object, int minutes) 
	{
		int i = 0, total=0;
		float bad = 0;
		for (i; i < object->num_items;i++) {
			bad += bake (object->list[i], minutes);
			total += object->list[i]->quantity;
		}

		float ratio = 1 - (bad / total);

		printf ("%f %d %f", bad, total, ratio);

		if (ratio > .33) {
			yyerror ("boil is not valid on this operation"); exit (-1);
		}

	}

	void mix_grill (struct mixture* object, int minutes) 
	{
		int i = 0, total=0;
		float bad = 0;
		for (i; i < object->num_items;i++) {
			bad += bake (object->list[i], minutes);
			total += object->list[i]->quantity;
		}

		float ratio = bad / total;

		if (ratio > .33) {
			yyerror ("grill is not valid on this operation"); exit (-1);
		}
	}

	void mix_fry (struct mixture* object, int minutes) 
	{
		int i = 0, total=0;
		float bad = 0;
		for (i; i < object->num_items;i++) {
			bad += bake (object->list[i], minutes);
			total += object->list[i]->quantity;
		}

		float ratio = bad / total;

		if (ratio > .33) {
			yyerror ("fry is not valid on this operation"); exit (-1);
		}
	}
	

	/*we want a control function so that its easier to deal with which of the different functions work on each variables
	- basically thought this tests that the id that calls the function is of FGROUP type and then calls the function with that address
	and any other parameters*/

	void method (struct param_list params)
	{
		/*get_address of food type*/
		rh_address *lh_addr = get_address_size ((char*) params.list[0].value, FGROUP, MIXTYPE);
		int lh_type = get_type ((char*) params.list[0].value);
		
		/*evaluate the number*/
		int num_times = 0;
		if (params.list[2].is_name) {
			struct rh_address *rh_addr = get_address_size ((char*) params.list[2].value, INTEGER, -1);
			num_times = *((int*) rh_addr->addr);	
		}
		else if (params.list[2].is_accsr) {
			struct param_list *accsr = (struct param_list*) params.list[2].value;
			rh_address *rh_addr = get_address_size ((char*) accsr->list[0].value, FGROUP, -1);
			switch (accsr->list[1].value) {
				case FNAME:	yyerror ("Cooking functions don't take strings as parameters"); exit(-1);break;
				case FQUANTITY:	num_times = ((cooltype *) rh_addr->addr)->quantity; break;
				case FNUTRITION:	num_times = ((cooltype *) rh_addr->addr)->nutrition; break;
				case FTIME:		num_times = ((cooltype *) rh_addr->addr)->time; break;
			}
		}			
		else {
			num_times = params.list[2].value;
		}

		if (lh_type == FGROUP) {
			int bad = 0;
			/*redirect to appropriate function - one set for mixtures and one set for non-mixtures*/
			if (! strncmp((char*) params.list[1].value, "boil", 4)) {
				bad = boil ( ((cooltype*) lh_addr->addr), num_times);
				if (bad) {
					printf ("$s", (char*) ((cooltype*) lh_addr->addr)->name);  yyerror (" can't be boiled"); exit (-1);
				}
			}
			else if (! strncmp((char*) params.list[1].value, "bake", 4)) {
				bad = bake ( ((cooltype*) lh_addr->addr), num_times);
				if (bad) {
					printf ("$s", (char*) ((cooltype*) lh_addr->addr)->name);  yyerror (" can't be baked"); exit (-1);
				}
			}
			else if (! strncmp((char*) params.list[1].value, "grill", 5)) {
				bad = grill ( ((cooltype*) lh_addr->addr), num_times);
				if (bad) {
					printf ("$s", (char*) ((cooltype*) lh_addr->addr)->name);  yyerror (" can't be grilled"); exit (-1);
				}
			}
			else if (! strncmp((char*) params.list[1].value, "fry", 3)) {
				bad = fry ( ((cooltype*) lh_addr->addr), num_times);
				if (bad) {
					printf ("$s", (char*) ((cooltype*) lh_addr->addr)->name);  yyerror (" can't be fried"); exit (-1);
				}
			}
		}
		else {/* is MIX */
			if (! strncmp((char*) params.list[1].value, "boil", 4)) {
				mix_boil ( ((struct mixture*) lh_addr->addr), num_times);
			}
			else if (! strncmp((char*) params.list[1].value, "bake", 4)) {
				mix_bake ( ((struct mixture*) lh_addr->addr), num_times);
			}
			else if (! strncmp((char*) params.list[1].value, "grill", 5)) {
				mix_grill ( ((struct mixture*) lh_addr->addr), num_times);
			}
			else if (! strncmp((char*) params.list[1].value, "fry", 3)) {
				mix_fry ( ((struct mixture*) lh_addr->addr), num_times);
			}
		}
	}

	void combine (struct param_list params)
	{
		/*take the name of the lh_side of the top */
		/*create a new mixture type*/
		struct mixture *new = (struct mixture*) get_address_size ((char*) params.list[params.num_params].value, MIXTYPE, -1)->addr;
		
		new->name = (char*) params.list[params.num_params].value;
	
		int i;
		int j;
		int num_added = 0;
		struct mixture *temp;
		for (i = 0; i<params.num_params; i++) {

			
			int lh_type = get_type ((char*) params.list[i].value);
			cooltype* dummy = (cooltype*) malloc (sizeof (cooltype));
			
			switch (lh_type) {
				case FGROUP:  *dummy = *((cooltype*) get_address_size((char*) params.list[i].value, FGROUP, -1)->addr);
						new->list[num_added] = dummy; num_added++; break;


				case MIXTYPE:  temp = (struct mixture*) get_address_size((char*) params.list[i].value, MIXTYPE, -1)->addr;
						 for (j=0;j<temp->num_items;j++) {
							*dummy = *((cooltype*) get_address_size((char*) temp->list[j]->name, FGROUP, -1)->addr);
							new->list[num_added] = dummy;
							num_added++;
						 } break;
				default: yyerror ("only mixtures or food items may be combined\n"); exit(-1); break;
			}
		}

		/*determine if we need to change the types of the object in the array*/

		/*set num_items*/
		new->num_items = num_added;
	}

	void display (struct param_list params)
	{
		/*test that the variable is a mixture and get a temp */
		struct mixture *temp = (struct mixture*) get_address_size((char*) params.list[0].value, MIXTYPE, -1)->addr;

		/*get temporary cooltype and then an array of names and of the highest scorers for each type*/
		cooltype* averaged = (cooltype*) malloc (sizeof (cooltype));
		char* bests[7];
			int i;
			for(i=1;i<7;i++) {
				bests[i] = (char*) malloc (50);
				bests[i] = "\0";
			}
		float best_vals[7];
			for (i=1;i<7;i++) {
				best_vals[i] = 0;
			}

		char* all[20];
		int ing = 0;

		/*go through each and get values and such*/
		for (i = 0;i<temp->num_items;i++) {
			cooltype* current = temp->list[i];

			all[i] = current->name;
			ing++;

			averaged->quantity += current->quantity;
			averaged->nutrition += current->nutrition;

			averaged->nutrition_values.calories += current->nutrition_values.calories;
			if (current->quantity * current->nutrition_values.calories > best_vals[0]) {
				best_vals[0] = current->quantity * current->nutrition_values.calories;
				bests[0] = current->name;
			}

			averaged->nutrition_values.fat += current->nutrition_values.fat;
			if (current->quantity * current->nutrition_values.fat > best_vals[1]) {
				best_vals[1] = current->quantity * current->nutrition_values.fat;
				bests[1] = current->name;
			}

			averaged->nutrition_values.cholesterol += current->nutrition_values.cholesterol;
			if (current->quantity * current->nutrition_values.cholesterol > best_vals[2]) {
				best_vals[2] = current->quantity * current->nutrition_values.cholesterol;
				bests[2] = current->name;
			}

			averaged->nutrition_values.sugar += current->nutrition_values.sugar;
			if (current->quantity * current->nutrition_values.sugar > best_vals[3]) {
				best_vals[3] = current->quantity * current->nutrition_values.sugar;
				bests[3] = current->name;
			}

			averaged->nutrition_values.protein += current->nutrition_values.protein;
			if (current->quantity * current->nutrition_values.protein > best_vals[4]) {
				best_vals[4] = current->quantity * current->nutrition_values.protein;
				bests[4] = current->name;
			}

			averaged->nutrition_values.vitamin_a += current->nutrition_values.vitamin_a;
			if (current->quantity * current->nutrition_values.vitamin_a > best_vals[5]) {
				best_vals[5] = current->quantity * current->nutrition_values.vitamin_a;
				bests[5] = current->name;
			}

			averaged->nutrition_values.vitamin_c += current->nutrition_values.vitamin_c;
			if (current->quantity * current->nutrition_values.vitamin_c > best_vals[6]) {
				best_vals[6] = current->quantity * current->nutrition_values.vitamin_c;
				bests[6] = current->name;
			}			
		}
	
		/*do the displaying */
		printf ("\t\t\t\tNUTRITIONAL INFORMATION FOR %s\n", temp->name);
		printf ("Ingredients: ");
			for (i=0;i<ing;i++) {
				printf ("%s ", all[i]);
			} printf ("\n");
		printf ("\t\tNUMBER OF SERVINGS:\t%d\n", averaged->quantity);
		printf ("\t\tNUTRITION SCORE:\t\%d\n", averaged->nutrition / averaged->quantity);
		printf ("\t\tCALORIES:\t\t%f", averaged->nutrition_values.calories / averaged->quantity);
		printf ("\tBIGGEST CONTRIBUTOR: %s\n", bests[0]);
		printf ("\t\tFAT:\t\t\t%f", averaged->nutrition_values.fat / averaged->quantity);
		printf ("\tBIGGEST CONTRIBUTOR: %s\n", bests[1]);
		printf ("\t\tCHOLESTEROL:\t\t%f", averaged->nutrition_values.cholesterol / averaged->quantity);
		printf ("\tBIGGEST CONTRIBUTOR: %s\n", bests[2]);
		printf ("\t\tSUGAR:\t\t\t%f", averaged->nutrition_values.sugar / averaged->quantity);
		printf ("\tBIGGEST CONTRIBUTOR: %s\n", bests[3]);
		printf ("\t\tPROTEIN:\t\t%f", averaged->nutrition_values.protein / averaged->quantity);
		printf ("\tBIGGEST CONTRIBUTOR: %s\n", bests[4]);
		printf ("\t\tVITAMIN A:\t\t%f", averaged->nutrition_values.vitamin_a / averaged->quantity);
		printf ("\tBIGGEST CONTRIBUTOR: %s\n", bests[5]);
		printf ("\t\tVITAMIN C:\t\t%f", averaged->nutrition_values.vitamin_c / averaged->quantity);
		printf ("\tBIGGEST CONTRIBUTOR: %s\n", bests[6]);
	}

int yywrap() { 
#ifdef DEBUG
	printf(" < ==== S y m b o l   T a b l e ==== > \n");
	table_print(symboltable);
#endif
return 1; 
} 

int main(int argc, char *argv[]) {
  if( argc != 2 ) {
	printf("Usage: coolinary [filename]\n");
	exit(-1);
  }

  coolinary_init();
  yyin = fopen(argv[1], "r");
  if( yyin == NULL ) {
	printf("coolinary: no input files.\n");
	exit(-2);
  }
  yyparse();
  fclose(yyin);
  return(0);
}



/* Line 189 of yacc.c  */
#line 1405 "y.tab.c"

/* Enabling traces.  */
#ifndef YYDEBUG
# define YYDEBUG 0
#endif

/* Enabling verbose error messages.  */
#ifdef YYERROR_VERBOSE
# undef YYERROR_VERBOSE
# define YYERROR_VERBOSE 1
#else
# define YYERROR_VERBOSE 0
#endif

/* Enabling the token table.  */
#ifndef YYTOKEN_TABLE
# define YYTOKEN_TABLE 0
#endif


/* Tokens.  */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
   /* Put the tokens into the symbol table, so that GDB and other debuggers
      know about them.  */
   enum yytokentype {
     OBRACE = 258,
     EBRACE = 259,
     OPAREN = 260,
     EPAREN = 261,
     SEMI = 262,
     COMMA = 263,
     GROUP = 264,
     PRINT = 265,
     INT = 266,
     STRING = 267,
     IF = 268,
     THEN = 269,
     ELSE = 270,
     WHILE = 271,
     REPEAT = 272,
     NAME = 273,
     QUANTITY = 274,
     NUTRITION = 275,
     TIME = 276,
     MIXTURE = 277,
     DISPLAY = 278,
     EQ = 279,
     NE = 280,
     LT = 281,
     LE = 282,
     GT = 283,
     GE = 284,
     PLUS = 285,
     MINUS = 286,
     INC = 287,
     DEC = 288,
     ASSIGN = 289,
     DOT = 290,
     OVER = 291,
     TIMES = 292,
     COMBINE = 293,
     FTYPE = 294,
     MNAME = 295,
     ID = 296,
     ILIT = 297,
     SLIT = 298
   };
#endif
/* Tokens.  */
#define OBRACE 258
#define EBRACE 259
#define OPAREN 260
#define EPAREN 261
#define SEMI 262
#define COMMA 263
#define GROUP 264
#define PRINT 265
#define INT 266
#define STRING 267
#define IF 268
#define THEN 269
#define ELSE 270
#define WHILE 271
#define REPEAT 272
#define NAME 273
#define QUANTITY 274
#define NUTRITION 275
#define TIME 276
#define MIXTURE 277
#define DISPLAY 278
#define EQ 279
#define NE 280
#define LT 281
#define LE 282
#define GT 283
#define GE 284
#define PLUS 285
#define MINUS 286
#define INC 287
#define DEC 288
#define ASSIGN 289
#define DOT 290
#define OVER 291
#define TIMES 292
#define COMBINE 293
#define FTYPE 294
#define MNAME 295
#define ID 296
#define ILIT 297
#define SLIT 298




#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
{

/* Line 214 of yacc.c  */
#line 1336 "coolinary.y"

	long num;
	char* text;
	struct param	param;
	struct param_list plist;
	struct id_list idlist;
	struct statement stmt;
	struct statement_list slist;



/* Line 214 of yacc.c  */
#line 1539 "y.tab.c"
} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
#endif


/* Copy the second part of user declarations.  */


/* Line 264 of yacc.c  */
#line 1551 "y.tab.c"

#ifdef short
# undef short
#endif

#ifdef YYTYPE_UINT8
typedef YYTYPE_UINT8 yytype_uint8;
#else
typedef unsigned char yytype_uint8;
#endif

#ifdef YYTYPE_INT8
typedef YYTYPE_INT8 yytype_int8;
#elif (defined __STDC__ || defined __C99__FUNC__ \
     || defined __cplusplus || defined _MSC_VER)
typedef signed char yytype_int8;
#else
typedef short int yytype_int8;
#endif

#ifdef YYTYPE_UINT16
typedef YYTYPE_UINT16 yytype_uint16;
#else
typedef unsigned short int yytype_uint16;
#endif

#ifdef YYTYPE_INT16
typedef YYTYPE_INT16 yytype_int16;
#else
typedef short int yytype_int16;
#endif

#ifndef YYSIZE_T
# ifdef __SIZE_TYPE__
#  define YYSIZE_T __SIZE_TYPE__
# elif defined size_t
#  define YYSIZE_T size_t
# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
     || defined __cplusplus || defined _MSC_VER)
#  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
#  define YYSIZE_T size_t
# else
#  define YYSIZE_T unsigned int
# endif
#endif

#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)

#ifndef YY_
# if YYENABLE_NLS
#  if ENABLE_NLS
#   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
#   define YY_(msgid) dgettext ("bison-runtime", msgid)
#  endif
# endif
# ifndef YY_
#  define YY_(msgid) msgid
# endif
#endif

/* Suppress unused-variable warnings by "using" E.  */
#if ! defined lint || defined __GNUC__
# define YYUSE(e) ((void) (e))
#else
# define YYUSE(e) /* empty */
#endif

/* Identity function, used to suppress warnings about constant conditions.  */
#ifndef lint
# define YYID(n) (n)
#else
#if (defined __STDC__ || defined __C99__FUNC__ \
     || defined __cplusplus || defined _MSC_VER)
static int
YYID (int yyi)
#else
static int
YYID (yyi)
    int yyi;
#endif
{
  return yyi;
}
#endif

#if ! defined yyoverflow || YYERROR_VERBOSE

/* The parser invokes alloca or malloc; define the necessary symbols.  */

# ifdef YYSTACK_USE_ALLOCA
#  if YYSTACK_USE_ALLOCA
#   ifdef __GNUC__
#    define YYSTACK_ALLOC __builtin_alloca
#   elif defined __BUILTIN_VA_ARG_INCR
#    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
#   elif defined _AIX
#    define YYSTACK_ALLOC __alloca
#   elif defined _MSC_VER
#    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
#    define alloca _alloca
#   else
#    define YYSTACK_ALLOC alloca
#    if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
     || defined __cplusplus || defined _MSC_VER)
#     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
#     ifndef _STDLIB_H
#      define _STDLIB_H 1
#     endif
#    endif
#   endif
#  endif
# endif

# ifdef YYSTACK_ALLOC
   /* Pacify GCC's `empty if-body' warning.  */
#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
#  ifndef YYSTACK_ALLOC_MAXIMUM
    /* The OS might guarantee only one guard page at the bottom of the stack,
       and a page size can be as small as 4096 bytes.  So we cannot safely
       invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
       to allow for a few compiler-allocated temporary stack slots.  */
#   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
#  endif
# else
#  define YYSTACK_ALLOC YYMALLOC
#  define YYSTACK_FREE YYFREE
#  ifndef YYSTACK_ALLOC_MAXIMUM
#   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
#  endif
#  if (defined __cplusplus && ! defined _STDLIB_H \
       && ! ((defined YYMALLOC || defined malloc) \
	     && (defined YYFREE || defined free)))
#   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
#   ifndef _STDLIB_H
#    define _STDLIB_H 1
#   endif
#  endif
#  ifndef YYMALLOC
#   define YYMALLOC malloc
#   if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
     || defined __cplusplus || defined _MSC_VER)
void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
#   endif
#  endif
#  ifndef YYFREE
#   define YYFREE free
#   if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
     || defined __cplusplus || defined _MSC_VER)
void free (void *); /* INFRINGES ON USER NAME SPACE */
#   endif
#  endif
# endif
#endif /* ! defined yyoverflow || YYERROR_VERBOSE */


#if (! defined yyoverflow \
     && (! defined __cplusplus \
	 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))

/* A type that is properly aligned for any stack member.  */
union yyalloc
{
  yytype_int16 yyss_alloc;
  YYSTYPE yyvs_alloc;
};

/* The size of the maximum gap between one aligned stack and the next.  */
# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)

/* The size of an array large to enough to hold all stacks, each with
   N elements.  */
# define YYSTACK_BYTES(N) \
     ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
      + YYSTACK_GAP_MAXIMUM)

/* Copy COUNT objects from FROM to TO.  The source and destination do
   not overlap.  */
# ifndef YYCOPY
#  if defined __GNUC__ && 1 < __GNUC__
#   define YYCOPY(To, From, Count) \
      __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
#  else
#   define YYCOPY(To, From, Count)		\
      do					\
	{					\
	  YYSIZE_T yyi;				\
	  for (yyi = 0; yyi < (Count); yyi++)	\
	    (To)[yyi] = (From)[yyi];		\
	}					\
      while (YYID (0))
#  endif
# endif

/* Relocate STACK from its old location to the new one.  The
   local variables YYSIZE and YYSTACKSIZE give the old and new number of
   elements in the stack, and YYPTR gives the new location of the
   stack.  Advance YYPTR to a properly aligned location for the next
   stack.  */
# define YYSTACK_RELOCATE(Stack_alloc, Stack)				\
    do									\
      {									\
	YYSIZE_T yynewbytes;						\
	YYCOPY (&yyptr->Stack_alloc, Stack, yysize);			\
	Stack = &yyptr->Stack_alloc;					\
	yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
	yyptr += yynewbytes / sizeof (*yyptr);				\
      }									\
    while (YYID (0))

#endif

/* YYFINAL -- State number of the termination state.  */
#define YYFINAL  26
/* YYLAST -- Last index in YYTABLE.  */
#define YYLAST   146

/* YYNTOKENS -- Number of terminals.  */
#define YYNTOKENS  44
/* YYNNTS -- Number of nonterminals.  */
#define YYNNTS  22
/* YYNRULES -- Number of rules.  */
#define YYNRULES  57
/* YYNRULES -- Number of states.  */
#define YYNSTATES  134

/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
#define YYUNDEFTOK  2
#define YYMAXUTOK   298

#define YYTRANSLATE(YYX)						\
  ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)

/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
static const yytype_uint8 yytranslate[] =
{
       0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
       5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
      15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
      25,    26,    27,    28,    29,    30,    31,    32,    33,    34,
      35,    36,    37,    38,    39,    40,    41,    42,    43
};

#if YYDEBUG
/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
   YYRHS.  */
static const yytype_uint8 yyprhs[] =
{
       0,     0,     3,     4,     6,    10,    12,    15,    17,    19,
      21,    23,    25,    27,    29,    31,    35,    39,    43,    66,
      70,    72,    76,    81,    86,    93,   101,   104,   110,   118,
     124,   130,   136,   142,   150,   156,   159,   162,   166,   170,
     172,   174,   176,   178,   180,   184,   188,   192,   196,   198,
     200,   202,   204,   206,   208,   210,   212,   214
};

/* YYRHS -- A `-1'-separated list of the rules' RHS.  */
static const yytype_int8 yyrhs[] =
{
      45,     0,    -1,    -1,    46,    -1,     3,    47,     4,    -1,
      48,    -1,    47,    48,    -1,    49,    -1,    51,    -1,    52,
      -1,    53,    -1,    54,    -1,    55,    -1,    56,    -1,    57,
      -1,    11,    50,     7,    -1,    12,    50,     7,    -1,    39,
      50,     7,    -1,     9,    41,     5,    43,     8,    42,     8,
      42,     8,    42,     8,    42,     8,    42,     8,    42,     8,
      42,     8,    42,     6,     7,    -1,    22,    50,     7,    -1,
      41,    -1,    50,     8,    41,    -1,    41,    34,    61,     7,
      -1,    41,    34,    59,     7,    -1,    41,    35,    19,    34,
      61,     7,    -1,    41,    34,    38,     5,    50,     6,     7,
      -1,    58,     7,    -1,    13,     5,    60,     6,    46,    -1,
      13,     5,    60,     6,    46,    15,    46,    -1,    16,     5,
      60,     6,    46,    -1,    17,     5,    61,     6,    46,    -1,
      10,     5,    61,     6,     7,    -1,    10,     5,    59,     6,
       7,    -1,    41,    35,    40,     5,    61,     6,     7,    -1,
      23,     5,    41,     6,     7,    -1,    41,    32,    -1,    41,
      33,    -1,    61,    64,    61,    -1,    61,    65,    61,    -1,
      41,    -1,    42,    -1,    43,    -1,    62,    -1,    63,    -1,
      41,    35,    18,    -1,    41,    35,    19,    -1,    41,    35,
      20,    -1,    41,    35,    21,    -1,    30,    -1,    31,    -1,
      37,    -1,    36,    -1,    26,    -1,    27,    -1,    24,    -1,
      25,    -1,    29,    -1,    28,    -1
};

/* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
static const yytype_uint16 yyrline[] =
{
       0,  1361,  1361,  1362,  1365,  1368,  1369,  1372,  1373,  1374,
    1375,  1376,  1377,  1378,  1379,  1382,  1383,  1384,  1386,  1401,
    1404,  1405,  1408,  1409,  1410,  1414,  1419,  1422,  1428,  1441,
    1447,  1460,  1468,  1478,  1483,  1487,  1495,  1505,  1536,  1553,
    1554,  1555,  1556,  1557,  1560,  1565,  1568,  1571,  1576,  1577,
    1578,  1579,  1582,  1583,  1584,  1585,  1586,  1587
};
#endif

#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
   First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
static const char *const yytname[] =
{
  "$end", "error", "$undefined", "OBRACE", "EBRACE", "OPAREN", "EPAREN",
  "SEMI", "COMMA", "GROUP", "PRINT", "INT", "STRING", "IF", "THEN", "ELSE",
  "WHILE", "REPEAT", "NAME", "QUANTITY", "NUTRITION", "TIME", "MIXTURE",
  "DISPLAY", "EQ", "NE", "LT", "LE", "GT", "GE", "PLUS", "MINUS", "INC",
  "DEC", "ASSIGN", "DOT", "OVER", "TIMES", "COMBINE", "FTYPE", "MNAME",
  "ID", "ILIT", "SLIT", "$accept", "program", "compound_stmt", "stmt_list",
  "stmt", "decl_stmt", "decl_list", "assn_stmt", "expr_stmt",
  "selection_stmt", "iteration_stmt", "print_stmt", "method_stmt",
  "display_stmt", "postfix_expr", "arith_expr", "relational_expr",
  "base_type", "string_accessor", "int_accessor", "arith_op", "rel_op", 0
};
#endif

# ifdef YYPRINT
/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
   token YYLEX-NUM.  */
static const yytype_uint16 yytoknum[] =
{
       0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
     265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
     275,   276,   277,   278,   279,   280,   281,   282,   283,   284,
     285,   286,   287,   288,   289,   290,   291,   292,   293,   294,
     295,   296,   297,   298
};
# endif

/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
static const yytype_uint8 yyr1[] =
{
       0,    44,    45,    45,    46,    47,    47,    48,    48,    48,
      48,    48,    48,    48,    48,    49,    49,    49,    49,    49,
      50,    50,    51,    51,    51,    51,    52,    53,    53,    54,
      54,    55,    55,    56,    57,    58,    58,    59,    60,    61,
      61,    61,    61,    61,    62,    63,    63,    63,    64,    64,
      64,    64,    65,    65,    65,    65,    65,    65
};

/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
static const yytype_uint8 yyr2[] =
{
       0,     2,     0,     1,     3,     1,     2,     1,     1,     1,
       1,     1,     1,     1,     1,     3,     3,     3,    22,     3,
       1,     3,     4,     4,     6,     7,     2,     5,     7,     5,
       5,     5,     5,     7,     5,     2,     2,     3,     3,     1,
       1,     1,     1,     1,     3,     3,     3,     3,     1,     1,
       1,     1,     1,     1,     1,     1,     1,     1
};

/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
   STATE-NUM when YYTABLE doesn't specify something else to do.  Zero
   means the default is an error.  */
static const yytype_uint8 yydefact[] =
{
       2,     0,     0,     3,     0,     0,     0,     0,     0,     0,
       0,     0,     0,     0,     0,     0,     5,     7,     8,     9,
      10,    11,    12,    13,    14,     0,     1,     0,     0,    20,
       0,     0,     0,     0,     0,     0,     0,     0,    35,    36,
       0,     0,     4,     6,    26,     0,    39,    40,    41,     0,
       0,    42,    43,    15,     0,    16,     0,     0,     0,     0,
      19,     0,    17,     0,     0,     0,     0,     0,     0,     0,
       0,     0,    48,    49,    51,    50,     0,    21,     0,    54,
      55,    52,    53,    57,    56,     0,     0,     0,     0,     0,
      23,    22,     0,     0,     0,    44,    45,    46,    47,    32,
      31,    37,    27,    38,    29,    30,    34,     0,     0,     0,
       0,     0,     0,    24,     0,     0,    28,    25,    33,     0,
       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
       0,     0,     0,    18
};

/* YYDEFGOTO[NTERM-NUM].  */
static const yytype_int8 yydefgoto[] =
{
      -1,     2,     3,    15,    16,    17,    30,    18,    19,    20,
      21,    22,    23,    24,    25,    49,    56,    57,    51,    52,
      76,    85
};

/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
   STATE-NUM.  */
#define YYPACT_NINF -62
static const yytype_int8 yypact[] =
{
       2,    20,    24,   -62,   -39,    22,   -13,   -13,    29,    47,
      51,   -13,    55,   -13,    44,    -1,   -62,   -62,   -62,   -62,
     -62,   -62,   -62,   -62,   -62,    57,   -62,    62,   -23,   -62,
      73,    80,   -23,   -23,   -23,    82,    10,    84,   -62,   -62,
       3,    -5,   -62,   -62,   -62,    50,    59,   -62,   -62,    89,
      17,   -62,   -62,   -62,    56,   -62,    90,    46,    92,    93,
     -62,    94,   -62,    96,    95,    32,    69,    99,    97,    65,
     100,   101,   -62,   -62,   -62,   -62,   -23,   -62,     2,   -62,
     -62,   -62,   -62,   -62,   -62,   -23,     2,     2,   102,   -13,
     -62,   -62,   -23,   -23,    64,   -62,   -62,   -62,   -62,   -62,
     -62,   -62,    98,   -62,   -62,   -62,   -62,    49,   103,   105,
     104,     2,   107,   -62,   108,    74,   -62,   -62,   -62,   109,
      76,   111,    78,   113,    81,   114,    83,   116,    85,   118,
      86,   123,   124,   -62
};

/* YYPGOTO[NTERM-NUM].  */
static const yytype_int8 yypgoto[] =
{
     -62,   -62,   -61,   -62,   115,   -62,    -7,   -62,   -62,   -62,
     -62,   -62,   -62,   -62,   -62,   106,   110,   -27,   -62,   -62,
     -62,   -62
};

/* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
   positive, shift that token.  If negative, reduce the rule which
   number is the opposite.  If zero, do what YYDEFACT says.
   If YYTABLE_NINF, syntax error.  */
#define YYTABLE_NINF -1
static const yytype_uint8 yytable[] =
{
      31,    50,    27,    42,    35,     1,    37,    59,     4,     5,
       6,     7,     8,    65,    66,     9,    10,   102,    46,    47,
      48,    11,    12,    71,    26,   104,   105,    28,    29,     4,
       5,     6,     7,     8,    32,    67,     9,    10,    13,    91,
      14,    63,    11,    12,    46,    47,    48,    72,    73,   101,
     116,    61,    33,    74,    75,   112,    34,    54,   103,    13,
      36,    14,    72,    73,    44,   108,   109,    45,    74,    75,
      79,    80,    81,    82,    83,    84,    38,    39,    40,    41,
      53,    54,   107,    95,    96,    97,    98,    55,    54,    60,
      54,    62,    54,    68,    69,    70,    78,    77,    86,    87,
      88,    89,    90,    92,    93,    94,   110,    99,   100,   106,
     113,   114,   115,   111,   117,   118,   119,   120,   121,   122,
     123,   124,   126,   125,   128,   127,   130,   129,   131,   132,
      43,   133,     0,     0,     0,     0,     0,     0,     0,     0,
       0,     0,     0,    58,     0,     0,    64
};

static const yytype_int8 yycheck[] =
{
       7,    28,    41,     4,    11,     3,    13,    34,     9,    10,
      11,    12,    13,    40,    19,    16,    17,    78,    41,    42,
      43,    22,    23,     6,     0,    86,    87,     5,    41,     9,
      10,    11,    12,    13,     5,    40,    16,    17,    39,     7,
      41,    38,    22,    23,    41,    42,    43,    30,    31,    76,
     111,    41,     5,    36,    37,     6,     5,     8,    85,    39,
       5,    41,    30,    31,     7,    92,    93,     5,    36,    37,
      24,    25,    26,    27,    28,    29,    32,    33,    34,    35,
       7,     8,    89,    18,    19,    20,    21,     7,     8,     7,
       8,     7,     8,    43,    35,     6,     6,    41,     6,     6,
       6,     5,     7,    34,     5,     8,    42,     7,     7,     7,
       7,     6,     8,    15,     7,     7,    42,     8,    42,     8,
      42,     8,     8,    42,     8,    42,     8,    42,    42,     6,
      15,     7,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      -1,    -1,    -1,    33,    -1,    -1,    40
};

/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
   symbol of state STATE-NUM.  */
static const yytype_uint8 yystos[] =
{
       0,     3,    45,    46,     9,    10,    11,    12,    13,    16,
      17,    22,    23,    39,    41,    47,    48,    49,    51,    52,
      53,    54,    55,    56,    57,    58,     0,    41,     5,    41,
      50,    50,     5,     5,     5,    50,     5,    50,    32,    33,
      34,    35,     4,    48,     7,     5,    41,    42,    43,    59,
      61,    62,    63,     7,     8,     7,    60,    61,    60,    61,
       7,    41,     7,    38,    59,    61,    19,    40,    43,    35,
       6,     6,    30,    31,    36,    37,    64,    41,     6,    24,
      25,    26,    27,    28,    29,    65,     6,     6,     6,     5,
       7,     7,    34,     5,     8,    18,    19,    20,    21,     7,
       7,    61,    46,    61,    46,    46,     7,    50,    61,    61,
      42,    15,     6,     7,     6,     8,    46,     7,     7,    42,
       8,    42,     8,    42,     8,    42,     8,    42,     8,    42,
       8,    42,     6,     7
};

#define yyerrok		(yyerrstatus = 0)
#define yyclearin	(yychar = YYEMPTY)
#define YYEMPTY		(-2)
#define YYEOF		0

#define YYACCEPT	goto yyacceptlab
#define YYABORT		goto yyabortlab
#define YYERROR		goto yyerrorlab


/* Like YYERROR except do call yyerror.  This remains here temporarily
   to ease the transition to the new meaning of YYERROR, for GCC.
   Once GCC version 2 has supplanted version 1, this can go.  */

#define YYFAIL		goto yyerrlab

#define YYRECOVERING()  (!!yyerrstatus)

#define YYBACKUP(Token, Value)					\
do								\
  if (yychar == YYEMPTY && yylen == 1)				\
    {								\
      yychar = (Token);						\
      yylval = (Value);						\
      yytoken = YYTRANSLATE (yychar);				\
      YYPOPSTACK (1);						\
      goto yybackup;						\
    }								\
  else								\
    {								\
      yyerror (YY_("syntax error: cannot back up")); \
      YYERROR;							\
    }								\
while (YYID (0))


#define YYTERROR	1
#define YYERRCODE	256


/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
   If N is 0, then set CURRENT to the empty location which ends
   the previous symbol: RHS[0] (always defined).  */

#define YYRHSLOC(Rhs, K) ((Rhs)[K])
#ifndef YYLLOC_DEFAULT
# define YYLLOC_DEFAULT(Current, Rhs, N)				\
    do									\
      if (YYID (N))                                                    \
	{								\
	  (Current).first_line   = YYRHSLOC (Rhs, 1).first_line;	\
	  (Current).first_column = YYRHSLOC (Rhs, 1).first_column;	\
	  (Current).last_line    = YYRHSLOC (Rhs, N).last_line;		\
	  (Current).last_column  = YYRHSLOC (Rhs, N).last_column;	\
	}								\
      else								\
	{								\
	  (Current).first_line   = (Current).last_line   =		\
	    YYRHSLOC (Rhs, 0).last_line;				\
	  (Current).first_column = (Current).last_column =		\
	    YYRHSLOC (Rhs, 0).last_column;				\
	}								\
    while (YYID (0))
#endif


/* YY_LOCATION_PRINT -- Print the location on the stream.
   This macro was not mandated originally: define only if we know
   we won't break user code: when these are the locations we know.  */

#ifndef YY_LOCATION_PRINT
# if YYLTYPE_IS_TRIVIAL
#  define YY_LOCATION_PRINT(File, Loc)			\
     fprintf (File, "%d.%d-%d.%d",			\
	      (Loc).first_line, (Loc).first_column,	\
	      (Loc).last_line,  (Loc).last_column)
# else
#  define YY_LOCATION_PRINT(File, Loc) ((void) 0)
# endif
#endif


/* YYLEX -- calling `yylex' with the right arguments.  */

#ifdef YYLEX_PARAM
# define YYLEX yylex (YYLEX_PARAM)
#else
# define YYLEX yylex ()
#endif

/* Enable debugging if requested.  */
#if YYDEBUG

# ifndef YYFPRINTF
#  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
#  define YYFPRINTF fprintf
# endif

# define YYDPRINTF(Args)			\
do {						\
  if (yydebug)					\
    YYFPRINTF Args;				\
} while (YYID (0))

# define YY_SYMBOL_PRINT(Title, Type, Value, Location)			  \
do {									  \
  if (yydebug)								  \
    {									  \
      YYFPRINTF (stderr, "%s ", Title);					  \
      yy_symbol_print (stderr,						  \
		  Type, Value); \
      YYFPRINTF (stderr, "\n");						  \
    }									  \
} while (YYID (0))


/*--------------------------------.
| Print this symbol on YYOUTPUT.  |
`--------------------------------*/

/*ARGSUSED*/
#if (defined __STDC__ || defined __C99__FUNC__ \
     || defined __cplusplus || defined _MSC_VER)
static void
yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
#else
static void
yy_symbol_value_print (yyoutput, yytype, yyvaluep)
    FILE *yyoutput;
    int yytype;
    YYSTYPE const * const yyvaluep;
#endif
{
  if (!yyvaluep)
    return;
# ifdef YYPRINT
  if (yytype < YYNTOKENS)
    YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
# else
  YYUSE (yyoutput);
# endif
  switch (yytype)
    {
      default:
	break;
    }
}


/*--------------------------------.
| Print this symbol on YYOUTPUT.  |
`--------------------------------*/

#if (defined __STDC__ || defined __C99__FUNC__ \
     || defined __cplusplus || defined _MSC_VER)
static void
yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
#else
static void
yy_symbol_print (yyoutput, yytype, yyvaluep)
    FILE *yyoutput;
    int yytype;
    YYSTYPE const * const yyvaluep;
#endif
{
  if (yytype < YYNTOKENS)
    YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
  else
    YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);

  yy_symbol_value_print (yyoutput, yytype, yyvaluep);
  YYFPRINTF (yyoutput, ")");
}

/*------------------------------------------------------------------.
| yy_stack_print -- Print the state stack from its BOTTOM up to its |
| TOP (included).                                                   |
`------------------------------------------------------------------*/

#if (defined __STDC__ || defined __C99__FUNC__ \
     || defined __cplusplus || defined _MSC_VER)
static void
yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
#else
static void
yy_stack_print (yybottom, yytop)
    yytype_int16 *yybottom;
    yytype_int16 *yytop;
#endif
{
  YYFPRINTF (stderr, "Stack now");
  for (; yybottom <= yytop; yybottom++)
    {
      int yybot = *yybottom;
      YYFPRINTF (stderr, " %d", yybot);
    }
  YYFPRINTF (stderr, "\n");
}

# define YY_STACK_PRINT(Bottom, Top)				\
do {								\
  if (yydebug)							\
    yy_stack_print ((Bottom), (Top));				\
} while (YYID (0))


/*------------------------------------------------.
| Report that the YYRULE is going to be reduced.  |
`------------------------------------------------*/

#if (defined __STDC__ || defined __C99__FUNC__ \
     || defined __cplusplus || defined _MSC_VER)
static void
yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
#else
static void
yy_reduce_print (yyvsp, yyrule)
    YYSTYPE *yyvsp;
    int yyrule;
#endif
{
  int yynrhs = yyr2[yyrule];
  int yyi;
  unsigned long int yylno = yyrline[yyrule];
  YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
	     yyrule - 1, yylno);
  /* The symbols being reduced.  */
  for (yyi = 0; yyi < yynrhs; yyi++)
    {
      YYFPRINTF (stderr, "   $%d = ", yyi + 1);
      yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
		       &(yyvsp[(yyi + 1) - (yynrhs)])
		       		       );
      YYFPRINTF (stderr, "\n");
    }
}

# define YY_REDUCE_PRINT(Rule)		\
do {					\
  if (yydebug)				\
    yy_reduce_print (yyvsp, Rule); \
} while (YYID (0))

/* Nonzero means print parse trace.  It is left uninitialized so that
   multiple parsers can coexist.  */
int yydebug;
#else /* !YYDEBUG */
# define YYDPRINTF(Args)
# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
# define YY_STACK_PRINT(Bottom, Top)
# define YY_REDUCE_PRINT(Rule)
#endif /* !YYDEBUG */


/* YYINITDEPTH -- initial size of the parser's stacks.  */
#ifndef	YYINITDEPTH
# define YYINITDEPTH 200
#endif

/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
   if the built-in stack extension method is used).

   Do not make this value too large; the results are undefined if
   YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
   evaluated with infinite-precision integer arithmetic.  */

#ifndef YYMAXDEPTH
# define YYMAXDEPTH 10000
#endif



#if YYERROR_VERBOSE

# ifndef yystrlen
#  if defined __GLIBC__ && defined _STRING_H
#   define yystrlen strlen
#  else
/* Return the length of YYSTR.  */
#if (defined __STDC__ || defined __C99__FUNC__ \
     || defined __cplusplus || defined _MSC_VER)
static YYSIZE_T
yystrlen (const char *yystr)
#else
static YYSIZE_T
yystrlen (yystr)
    const char *yystr;
#endif
{
  YYSIZE_T yylen;
  for (yylen = 0; yystr[yylen]; yylen++)
    continue;
  return yylen;
}
#  endif
# endif

# ifndef yystpcpy
#  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
#   define yystpcpy stpcpy
#  else
/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
   YYDEST.  */
#if (defined __STDC__ || defined __C99__FUNC__ \
     || defined __cplusplus || defined _MSC_VER)
static char *
yystpcpy (char *yydest, const char *yysrc)
#else
static char *
yystpcpy (yydest, yysrc)
    char *yydest;
    const char *yysrc;
#endif
{
  char *yyd = yydest;
  const char *yys = yysrc;

  while ((*yyd++ = *yys++) != '\0')
    continue;

  return yyd - 1;
}
#  endif
# endif

# ifndef yytnamerr
/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
   quotes and backslashes, so that it's suitable for yyerror.  The
   heuristic is that double-quoting is unnecessary unless the string
   contains an apostrophe, a comma, or backslash (other than
   backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
   null, do not copy; instead, return the length of what the result
   would have been.  */
static YYSIZE_T
yytnamerr (char *yyres, const char *yystr)
{
  if (*yystr == '"')
    {
      YYSIZE_T yyn = 0;
      char const *yyp = yystr;

      for (;;)
	switch (*++yyp)
	  {
	  case '\'':
	  case ',':
	    goto do_not_strip_quotes;

	  case '\\':
	    if (*++yyp != '\\')
	      goto do_not_strip_quotes;
	    /* Fall through.  */
	  default:
	    if (yyres)
	      yyres[yyn] = *yyp;
	    yyn++;
	    break;

	  case '"':
	    if (yyres)
	      yyres[yyn] = '\0';
	    return yyn;
	  }
    do_not_strip_quotes: ;
    }

  if (! yyres)
    return yystrlen (yystr);

  return yystpcpy (yyres, yystr) - yyres;
}
# endif

/* Copy into YYRESULT an error message about the unexpected token
   YYCHAR while in state YYSTATE.  Return the number of bytes copied,
   including the terminating null byte.  If YYRESULT is null, do not
   copy anything; just return the number of bytes that would be
   copied.  As a special case, return 0 if an ordinary "syntax error"
   message will do.  Return YYSIZE_MAXIMUM if overflow occurs during
   size calculation.  */
static YYSIZE_T
yysyntax_error (char *yyresult, int yystate, int yychar)
{
  int yyn = yypact[yystate];

  if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
    return 0;
  else
    {
      int yytype = YYTRANSLATE (yychar);
      YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
      YYSIZE_T yysize = yysize0;
      YYSIZE_T yysize1;
      int yysize_overflow = 0;
      enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
      char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
      int yyx;

# if 0
      /* This is so xgettext sees the translatable formats that are
	 constructed on the fly.  */
      YY_("syntax error, unexpected %s");
      YY_("syntax error, unexpected %s, expecting %s");
      YY_("syntax error, unexpected %s, expecting %s or %s");
      YY_("syntax error, unexpected %s, expecting %s or %s or %s");
      YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
# endif
      char *yyfmt;
      char const *yyf;
      static char const yyunexpected[] = "syntax error, unexpected %s";
      static char const yyexpecting[] = ", expecting %s";
      static char const yyor[] = " or %s";
      char yyformat[sizeof yyunexpected
		    + sizeof yyexpecting - 1
		    + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
		       * (sizeof yyor - 1))];
      char const *yyprefix = yyexpecting;

      /* Start YYX at -YYN if negative to avoid negative indexes in
	 YYCHECK.  */
      int yyxbegin = yyn < 0 ? -yyn : 0;

      /* Stay within bounds of both yycheck and yytname.  */
      int yychecklim = YYLAST - yyn + 1;
      int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
      int yycount = 1;

      yyarg[0] = yytname[yytype];
      yyfmt = yystpcpy (yyformat, yyunexpected);

      for (yyx = yyxbegin; yyx < yyxend; ++yyx)
	if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
	  {
	    if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
	      {
		yycount = 1;
		yysize = yysize0;
		yyformat[sizeof yyunexpected - 1] = '\0';
		break;
	      }
	    yyarg[yycount++] = yytname[yyx];
	    yysize1 = yysize + yytnamerr (0, yytname[yyx]);
	    yysize_overflow |= (yysize1 < yysize);
	    yysize = yysize1;
	    yyfmt = yystpcpy (yyfmt, yyprefix);
	    yyprefix = yyor;
	  }

      yyf = YY_(yyformat);
      yysize1 = yysize + yystrlen (yyf);
      yysize_overflow |= (yysize1 < yysize);
      yysize = yysize1;

      if (yysize_overflow)
	return YYSIZE_MAXIMUM;

      if (yyresult)
	{
	  /* Avoid sprintf, as that infringes on the user's name space.
	     Don't have undefined behavior even if the translation
	     produced a string with the wrong number of "%s"s.  */
	  char *yyp = yyresult;
	  int yyi = 0;
	  while ((*yyp = *yyf) != '\0')
	    {
	      if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
		{
		  yyp += yytnamerr (yyp, yyarg[yyi++]);
		  yyf += 2;
		}
	      else
		{
		  yyp++;
		  yyf++;
		}
	    }
	}
      return yysize;
    }
}
#endif /* YYERROR_VERBOSE */


/*-----------------------------------------------.
| Release the memory associated to this symbol.  |
`-----------------------------------------------*/

/*ARGSUSED*/
#if (defined __STDC__ || defined __C99__FUNC__ \
     || defined __cplusplus || defined _MSC_VER)
static void
yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
#else
static void
yydestruct (yymsg, yytype, yyvaluep)
    const char *yymsg;
    int yytype;
    YYSTYPE *yyvaluep;
#endif
{
  YYUSE (yyvaluep);

  if (!yymsg)
    yymsg = "Deleting";
  YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);

  switch (yytype)
    {

      default:
	break;
    }
}

/* Prevent warnings from -Wmissing-prototypes.  */
#ifdef YYPARSE_PARAM
#if defined __STDC__ || defined __cplusplus
int yyparse (void *YYPARSE_PARAM);
#else
int yyparse ();
#endif
#else /* ! YYPARSE_PARAM */
#if defined __STDC__ || defined __cplusplus
int yyparse (void);
#else
int yyparse ();
#endif
#endif /* ! YYPARSE_PARAM */


/* The lookahead symbol.  */
int yychar;

/* The semantic value of the lookahead symbol.  */
YYSTYPE yylval;

/* Number of syntax errors so far.  */
int yynerrs;



/*-------------------------.
| yyparse or yypush_parse.  |
`-------------------------*/

#ifdef YYPARSE_PARAM
#if (defined __STDC__ || defined __C99__FUNC__ \
     || defined __cplusplus || defined _MSC_VER)
int
yyparse (void *YYPARSE_PARAM)
#else
int
yyparse (YYPARSE_PARAM)
    void *YYPARSE_PARAM;
#endif
#else /* ! YYPARSE_PARAM */
#if (defined __STDC__ || defined __C99__FUNC__ \
     || defined __cplusplus || defined _MSC_VER)
int
yyparse (void)
#else
int
yyparse ()

#endif
#endif
{


    int yystate;
    /* Number of tokens to shift before error messages enabled.  */
    int yyerrstatus;

    /* The stacks and their tools:
       `yyss': related to states.
       `yyvs': related to semantic values.

       Refer to the stacks thru separate pointers, to allow yyoverflow
       to reallocate them elsewhere.  */

    /* The state stack.  */
    yytype_int16 yyssa[YYINITDEPTH];
    yytype_int16 *yyss;
    yytype_int16 *yyssp;

    /* The semantic value stack.  */
    YYSTYPE yyvsa[YYINITDEPTH];
    YYSTYPE *yyvs;
    YYSTYPE *yyvsp;

    YYSIZE_T yystacksize;

  int yyn;
  int yyresult;
  /* Lookahead token as an internal (translated) token number.  */
  int yytoken;
  /* The variables used to return semantic value and location from the
     action routines.  */
  YYSTYPE yyval;

#if YYERROR_VERBOSE
  /* Buffer for error messages, and its allocated size.  */
  char yymsgbuf[128];
  char *yymsg = yymsgbuf;
  YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
#endif

#define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))

  /* The number of symbols on the RHS of the reduced rule.
     Keep to zero when no symbol should be popped.  */
  int yylen = 0;

  yytoken = 0;
  yyss = yyssa;
  yyvs = yyvsa;
  yystacksize = YYINITDEPTH;

  YYDPRINTF ((stderr, "Starting parse\n"));

  yystate = 0;
  yyerrstatus = 0;
  yynerrs = 0;
  yychar = YYEMPTY; /* Cause a token to be read.  */

  /* Initialize stack pointers.
     Waste one element of value and location stack
     so that they stay on the same level as the state stack.
     The wasted elements are never initialized.  */
  yyssp = yyss;
  yyvsp = yyvs;

  goto yysetstate;

/*------------------------------------------------------------.
| yynewstate -- Push a new state, which is found in yystate.  |
`------------------------------------------------------------*/
 yynewstate:
  /* In all cases, when you get here, the value and location stacks
     have just been pushed.  So pushing a state here evens the stacks.  */
  yyssp++;

 yysetstate:
  *yyssp = yystate;

  if (yyss + yystacksize - 1 <= yyssp)
    {
      /* Get the current used size of the three stacks, in elements.  */
      YYSIZE_T yysize = yyssp - yyss + 1;

#ifdef yyoverflow
      {
	/* Give user a chance to reallocate the stack.  Use copies of
	   these so that the &'s don't force the real ones into
	   memory.  */
	YYSTYPE *yyvs1 = yyvs;
	yytype_int16 *yyss1 = yyss;

	/* Each stack pointer address is followed by the size of the
	   data in use in that stack, in bytes.  This used to be a
	   conditional around just the two extra args, but that might
	   be undefined if yyoverflow is a macro.  */
	yyoverflow (YY_("memory exhausted"),
		    &yyss1, yysize * sizeof (*yyssp),
		    &yyvs1, yysize * sizeof (*yyvsp),
		    &yystacksize);

	yyss = yyss1;
	yyvs = yyvs1;
      }
#else /* no yyoverflow */
# ifndef YYSTACK_RELOCATE
      goto yyexhaustedlab;
# else
      /* Extend the stack our own way.  */
      if (YYMAXDEPTH <= yystacksize)
	goto yyexhaustedlab;
      yystacksize *= 2;
      if (YYMAXDEPTH < yystacksize)
	yystacksize = YYMAXDEPTH;

      {
	yytype_int16 *yyss1 = yyss;
	union yyalloc *yyptr =
	  (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
	if (! yyptr)
	  goto yyexhaustedlab;
	YYSTACK_RELOCATE (yyss_alloc, yyss);
	YYSTACK_RELOCATE (yyvs_alloc, yyvs);
#  undef YYSTACK_RELOCATE
	if (yyss1 != yyssa)
	  YYSTACK_FREE (yyss1);
      }
# endif
#endif /* no yyoverflow */

      yyssp = yyss + yysize - 1;
      yyvsp = yyvs + yysize - 1;

      YYDPRINTF ((stderr, "Stack size increased to %lu\n",
		  (unsigned long int) yystacksize));

      if (yyss + yystacksize - 1 <= yyssp)
	YYABORT;
    }

  YYDPRINTF ((stderr, "Entering state %d\n", yystate));

  if (yystate == YYFINAL)
    YYACCEPT;

  goto yybackup;

/*-----------.
| yybackup.  |
`-----------*/
yybackup:

  /* Do appropriate processing given the current state.  Read a
     lookahead token if we need one and don't already have one.  */

  /* First try to decide what to do without reference to lookahead token.  */
  yyn = yypact[yystate];
  if (yyn == YYPACT_NINF)
    goto yydefault;

  /* Not known => get a lookahead token if don't already have one.  */

  /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
  if (yychar == YYEMPTY)
    {
      YYDPRINTF ((stderr, "Reading a token: "));
      yychar = YYLEX;
    }

  if (yychar <= YYEOF)
    {
      yychar = yytoken = YYEOF;
      YYDPRINTF ((stderr, "Now at end of input.\n"));
    }
  else
    {
      yytoken = YYTRANSLATE (yychar);
      YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
    }

  /* If the proper action on seeing token YYTOKEN is to reduce or to
     detect an error, take that action.  */
  yyn += yytoken;
  if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
    goto yydefault;
  yyn = yytable[yyn];
  if (yyn <= 0)
    {
      if (yyn == 0 || yyn == YYTABLE_NINF)
	goto yyerrlab;
      yyn = -yyn;
      goto yyreduce;
    }

  /* Count tokens shifted since error; after three, turn off error
     status.  */
  if (yyerrstatus)
    yyerrstatus--;

  /* Shift the lookahead token.  */
  YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);

  /* Discard the shifted token.  */
  yychar = YYEMPTY;

  yystate = yyn;
  *++yyvsp = yylval;

  goto yynewstate;


/*-----------------------------------------------------------.
| yydefault -- do the default action for the current state.  |
`-----------------------------------------------------------*/
yydefault:
  yyn = yydefact[yystate];
  if (yyn == 0)
    goto yyerrlab;
  goto yyreduce;


/*-----------------------------.
| yyreduce -- Do a reduction.  |
`-----------------------------*/
yyreduce:
  /* yyn is the number of a rule to reduce with.  */
  yylen = yyr2[yyn];

  /* If YYLEN is nonzero, implement the default value of the action:
     `$$ = $1'.

     Otherwise, the following line sets YYVAL to garbage.
     This behavior is undocumented and Bison
     users should not rely upon it.  Assigning to YYVAL
     unconditionally makes the parser a bit smaller, and it avoids a
     GCC warning that YYVAL may be used uninitialized.  */
  yyval = yyvsp[1-yylen];


  YY_REDUCE_PRINT (yyn);
  switch (yyn)
    {
        case 3:

/* Line 1455 of yacc.c  */
#line 1362 "coolinary.y"
    {execute((yyvsp[(1) - (1)].slist));}
    break;

  case 4:

/* Line 1455 of yacc.c  */
#line 1365 "coolinary.y"
    {(yyval.slist) = (yyvsp[(2) - (3)].slist);}
    break;

  case 5:

/* Line 1455 of yacc.c  */
#line 1368 "coolinary.y"
    {(yyval.slist).num_statements = 1; (yyval.slist).s_list[0] = (yyvsp[(1) - (1)].stmt);}
    break;

  case 6:

/* Line 1455 of yacc.c  */
#line 1369 "coolinary.y"
    {(yyval.slist).num_statements = (yyvsp[(1) - (2)].slist).num_statements + 1; (yyval.slist).s_list[(yyvsp[(1) - (2)].slist).num_statements] = (yyvsp[(2) - (2)].stmt);}
    break;

  case 7:

/* Line 1455 of yacc.c  */
#line 1372 "coolinary.y"
    {(yyval.stmt) = (yyvsp[(1) - (1)].stmt);}
    break;

  case 8:

/* Line 1455 of yacc.c  */
#line 1373 "coolinary.y"
    {(yyval.stmt) = (yyvsp[(1) - (1)].stmt);}
    break;

  case 9:

/* Line 1455 of yacc.c  */
#line 1374 "coolinary.y"
    {(yyval.stmt) = (yyvsp[(1) - (1)].stmt);}
    break;

  case 10:

/* Line 1455 of yacc.c  */
#line 1375 "coolinary.y"
    {(yyval.stmt) = (yyvsp[(1) - (1)].stmt);}
    break;

  case 11:

/* Line 1455 of yacc.c  */
#line 1376 "coolinary.y"
    {(yyval.stmt) = (yyvsp[(1) - (1)].stmt);}
    break;

  case 12:

/* Line 1455 of yacc.c  */
#line 1377 "coolinary.y"
    {(yyval.stmt) = (yyvsp[(1) - (1)].stmt);}
    break;

  case 13:

/* Line 1455 of yacc.c  */
#line 1378 "coolinary.y"
    {(yyval.stmt) = (yyvsp[(1) - (1)].stmt);}
    break;

  case 14:

/* Line 1455 of yacc.c  */
#line 1379 "coolinary.y"
    {(yyval.stmt) = (yyvsp[(1) - (1)].stmt);}
    break;

  case 15:

/* Line 1455 of yacc.c  */
#line 1382 "coolinary.y"
    {(yyval.stmt).fpointer = int_declare; (yyval.stmt).p_list = ids_to_params ((yyvsp[(2) - (3)].idlist));}
    break;

  case 16:

/* Line 1455 of yacc.c  */
#line 1383 "coolinary.y"
    {(yyval.stmt).fpointer = string_declare; (yyval.stmt).p_list = ids_to_params ((yyvsp[(2) - (3)].idlist));}
    break;

  case 17:

/* Line 1455 of yacc.c  */
#line 1384 "coolinary.y"
    {(yyval.stmt).fpointer = fgroup_declare; (yyval.stmt).p_list = ids_to_params ((yyvsp[(2) - (3)].idlist));
						(yyval.stmt).p_list.list[(yyval.stmt).p_list.num_params].value = (long) (yyvsp[(1) - (3)].text); (yyval.stmt).p_list.num_params++;}
    break;

  case 18:

/* Line 1455 of yacc.c  */
#line 1390 "coolinary.y"
    {(yyval.stmt).fpointer = user_declare; 
						(yyval.stmt).p_list.list[0].value = (long) (yyvsp[(2) - (22)].text);  
						(yyval.stmt).p_list.list[1].value = (long) (yyvsp[(4) - (22)].text);  
						(yyval.stmt).p_list.list[2].value = (yyvsp[(6) - (22)].num);
						(yyval.stmt).p_list.list[3].value = (yyvsp[(8) - (22)].num);
						(yyval.stmt).p_list.list[4].value = (yyvsp[(10) - (22)].num);
						(yyval.stmt).p_list.list[5].value = (yyvsp[(12) - (22)].num);
						(yyval.stmt).p_list.list[6].value = (yyvsp[(14) - (22)].num);
						(yyval.stmt).p_list.list[7].value = (yyvsp[(16) - (22)].num);
						(yyval.stmt).p_list.list[8].value = (yyvsp[(18) - (22)].num);
						(yyval.stmt).p_list.list[9].value = (yyvsp[(20) - (22)].num);}
    break;

  case 19:

/* Line 1455 of yacc.c  */
#line 1401 "coolinary.y"
    {(yyval.stmt).fpointer = mix_declare; (yyval.stmt).p_list = ids_to_params ((yyvsp[(2) - (3)].idlist));}
    break;

  case 20:

/* Line 1455 of yacc.c  */
#line 1404 "coolinary.y"
    {(yyval.idlist).num_ids = 1; (yyval.idlist).list[0] = strdup((yyvsp[(1) - (1)].text));}
    break;

  case 21:

/* Line 1455 of yacc.c  */
#line 1405 "coolinary.y"
    {(yyval.idlist).num_ids = (yyvsp[(1) - (3)].idlist).num_ids + 1; (yyval.idlist).list[(yyvsp[(1) - (3)].idlist).num_ids] = strdup((yyvsp[(3) - (3)].text));}
    break;

  case 22:

/* Line 1455 of yacc.c  */
#line 1408 "coolinary.y"
    {(yyval.stmt).fpointer = assign; (yyval.stmt).p_list.list[0].value = (long) (yyvsp[(1) - (4)].text); (yyval.stmt).p_list.list[1] = (yyvsp[(3) - (4)].param);}
    break;

  case 23:

/* Line 1455 of yacc.c  */
#line 1409 "coolinary.y"
    {(yyval.stmt).fpointer = assign; (yyval.stmt).p_list.list[0].value = (long) (yyvsp[(1) - (4)].text); (yyval.stmt).p_list.list[1] = (yyvsp[(3) - (4)].param);}
    break;

  case 24:

/* Line 1455 of yacc.c  */
#line 1410 "coolinary.y"
    {if (! (yyvsp[(5) - (6)].param).is_name && ! (yyvsp[(5) - (6)].param).is_accsr && (yyvsp[(5) - (6)].param).type != INTEGER) {
									yyerror ("Only integer values can be assigned to a quantity field"); exit(-1);
								}
								(yyval.stmt).fpointer = assign_quantity; (yyval.stmt).p_list.list[0].value = (long) (yyvsp[(1) - (6)].text); (yyval.stmt).p_list.list[1] = (yyvsp[(5) - (6)].param);}
    break;

  case 25:

/* Line 1455 of yacc.c  */
#line 1414 "coolinary.y"
    {(yyval.stmt).fpointer = combine;  (yyval.stmt).p_list = ids_to_params ((yyvsp[(5) - (7)].idlist));
									 (yyval.stmt).p_list.list[(yyval.stmt).p_list.num_params].value = (long) (yyvsp[(1) - (7)].text);}
    break;

  case 26:

/* Line 1455 of yacc.c  */
#line 1419 "coolinary.y"
    {(yyval.stmt).fpointer = assign; (yyval.stmt).p_list = (yyvsp[(1) - (2)].plist);}
    break;

  case 27:

/* Line 1455 of yacc.c  */
#line 1422 "coolinary.y"
    {(yyval.stmt).fpointer = simple_if; (yyval.stmt).p_list.list[0] = (yyvsp[(3) - (5)].param);
														struct statement_list* new = (struct statement_list*) 
															malloc (sizeof (struct statement_list));
														*new = (yyvsp[(5) - (5)].slist);
														(yyval.stmt).p_list.list[1].value = (long) new;}
    break;

  case 28:

/* Line 1455 of yacc.c  */
#line 1428 "coolinary.y"
    {(yyval.stmt).fpointer = if_then_else; (yyval.stmt).p_list.list[0] = (yyvsp[(3) - (7)].param);
														struct statement_list* new = (struct statement_list*) 
															malloc (sizeof (struct statement_list));
														*new = (yyvsp[(5) - (7)].slist);
														(yyval.stmt).p_list.list[1].value = (long) new;
														struct statement_list* new1 = (struct statement_list*) 
															malloc (sizeof (struct statement_list));
														*new1 = (yyvsp[(7) - (7)].slist);
														(yyval.stmt).p_list.list[2].value = (long) new1;
														}
    break;

  case 29:

/* Line 1455 of yacc.c  */
#line 1441 "coolinary.y"
    {(yyval.stmt).fpointer = while_loop; (yyval.stmt).p_list.list[0] = (yyvsp[(3) - (5)].param);
											struct statement_list* new = (struct statement_list*) malloc (sizeof (struct statement_list));
											*new = (yyvsp[(5) - (5)].slist);
											(yyval.stmt).p_list.list[1].value = (long) new;											
											}
    break;

  case 30:

/* Line 1455 of yacc.c  */
#line 1447 "coolinary.y"
    {if ((yyvsp[(3) - (5)].param).type != INTEGER && (yyvsp[(3) - (5)].param).type != EMPTY) {
												yyerror ("Repeat only takes integer literals or variables\n");
												exit (-1);
											}
											else {
												(yyval.stmt).fpointer = repeat_loop; (yyval.stmt).p_list.list[0] = (yyvsp[(3) - (5)].param);
												struct statement_list* new = (struct statement_list*) malloc (sizeof (struct statement_list));
												*new = (yyvsp[(5) - (5)].slist);
												(yyval.stmt).p_list.list[1].value = (long) new;
											}}
    break;

  case 31:

/* Line 1455 of yacc.c  */
#line 1460 "coolinary.y"
    {if ((yyvsp[(3) - (5)].param).type != CSTRING && ! (yyvsp[(3) - (5)].param).is_name && ! (yyvsp[(3) - (5)].param).is_accsr) {
									yyerror ("print only takes strings or string expressions\n");
									exit (-1);
								}
								else {
									(yyval.stmt).fpointer = print;
									(yyval.stmt).p_list.list[0] = (yyvsp[(3) - (5)].param);
								}}
    break;

  case 32:

/* Line 1455 of yacc.c  */
#line 1468 "coolinary.y"
    {if ((yyvsp[(3) - (5)].param).type != CSTRING && (! (yyvsp[(3) - (5)].param).is_name && ! (yyvsp[(3) - (5)].param).is_expr && ! (yyvsp[(3) - (5)].param).is_accsr)) {
									yyerror ("print only takes strings or string expressions\n");
									exit (-1);
								}
								else {
									(yyval.stmt).fpointer = print;
									(yyval.stmt).p_list.list[0] = (yyvsp[(3) - (5)].param);
								}}
    break;

  case 33:

/* Line 1455 of yacc.c  */
#line 1478 "coolinary.y"
    {if ((yyvsp[(5) - (7)].param).type == CSTRING) {yyerror ("Cooking functions do not take a string as a parameter"); exit (-1);}
									else {(yyval.stmt).fpointer = method;  (yyval.stmt).p_list.list[0].value = (long) (yyvsp[(1) - (7)].text); (yyval.stmt).p_list.list[1].value = (long) (yyvsp[(3) - (7)].text);
									(yyval.stmt).p_list.list[2] = (yyvsp[(5) - (7)].param);}}
    break;

  case 34:

/* Line 1455 of yacc.c  */
#line 1483 "coolinary.y"
    {(yyval.stmt).fpointer = display; (yyval.stmt).p_list.list[0].value = (long) (yyvsp[(3) - (5)].text);}
    break;

  case 35:

/* Line 1455 of yacc.c  */
#line 1487 "coolinary.y"
    {(yyval.plist).list[0].value = (long) (yyvsp[(1) - (2)].text); (yyval.plist).list[0].is_name = 1;
							struct expression *temp = (struct expression*) malloc (sizeof (struct expression));
							temp->op = ADD; 
							temp->p_list.list[0] = (yyval.plist).list[0];
							temp->p_list.list[1].value = 1;  temp->p_list.list[1].is_name = 0; temp->p_list.list[1].type = INTEGER; 
							(yyval.plist).list[1].value = (long) temp; (yyval.plist).list[1].is_name = 0; (yyval.plist).list[1].is_expr = 1;
							}
    break;

  case 36:

/* Line 1455 of yacc.c  */
#line 1495 "coolinary.y"
    {(yyval.plist).list[0].value = (long) (yyvsp[(1) - (2)].text); (yyval.plist).list[0].is_name = 1;
							struct expression *temp = (struct expression*) malloc (sizeof (struct expression));
							temp->op = SUBTRACT; 
							temp->p_list.list[0] = (yyval.plist).list[0];
							temp->p_list.list[1].value = 1;  temp->p_list.list[1].is_name = 0; temp->p_list.list[1].type = INTEGER; 
							(yyval.plist).list[1].value = (long) temp; (yyval.plist).list[1].is_name = 0; (yyval.plist).list[1].is_expr = 1;
							}
    break;

  case 37:

/* Line 1455 of yacc.c  */
#line 1505 "coolinary.y"
    {	/*start by testing for whether they are variables - where possible evaluate to a constant so that we won't have to
								recalculate in a looping situation*/
								if ( ((!(yyvsp[(1) - (3)].param).is_name) && (!(yyvsp[(1) - (3)].param).is_accsr)) && ((!(yyvsp[(3) - (3)].param).is_name) && (!(yyvsp[(3) - (3)].param).is_accsr))) {
									if ((yyvsp[(1) - (3)].param).type == INTEGER && (yyvsp[(3) - (3)].param).type == INTEGER) {
										(yyval.param).value = short_int_evaluate((yyvsp[(1) - (3)].param).value, (yyvsp[(3) - (3)].param).value, (yyvsp[(2) - (3)].num)); (yyval.param).is_expr = 0; (yyval.param).is_name = 0;
										(yyval.param).is_accsr = 0; (yyval.param).type = INTEGER;
							 		}
									else if ((yyvsp[(1) - (3)].param).type == CSTRING && (yyvsp[(3) - (3)].param).type == CSTRING) {
										(yyval.param).value = (long) short_concatanate((char*) (yyvsp[(1) - (3)].param).value, (char*) (yyvsp[(3) - (3)].param).value); (yyval.param).is_expr = 0; (yyval.param).is_name = 0; 
										(yyval.param).is_accsr = 0; (yyval.param).type = CSTRING;
									}
									else if ((yyvsp[(1) - (3)].param).type == CSTRING && (yyvsp[(3) - (3)].param).type == INTEGER) {
										(yyval.param).value = (long) short_concatanate((char*) (yyvsp[(1) - (3)].param).value, itoa((yyvsp[(3) - (3)].param).value)); (yyval.param).is_expr = 0; (yyval.param).is_name = 0; 
										(yyval.param).is_accsr = 0; (yyval.param).type = CSTRING;
									}
									else {
										yyerror ("Coolinary does not allow operations on non-integer or string types.\n");
										exit(-1);
									}
								}
								/*turn int type expression - we don't type check here*/
								else {
									struct expression *temp = (struct expression*) malloc (sizeof (struct expression));
									temp->op = (yyvsp[(2) - (3)].num);
									temp->p_list.list[0] = (yyvsp[(1) - (3)].param); temp->p_list.list[1] = (yyvsp[(3) - (3)].param); 
									(yyval.param).value = (long) temp; (yyval.param).is_name = 0; (yyval.param).is_expr = 1; (yyval.param).is_accsr = 0; (yyval.param).type = EMPTY;									
								}
							}
    break;

  case 38:

/* Line 1455 of yacc.c  */
#line 1536 "coolinary.y"
    {if ((! (yyvsp[(1) - (3)].param).is_name && ! (yyvsp[(1) - (3)].param).is_accsr) && (! (yyvsp[(3) - (3)].param).is_name && ! (yyvsp[(3) - (3)].param).is_accsr)) {
									if ((yyvsp[(1) - (3)].param).type == INTEGER && (yyvsp[(3) - (3)].param).type == INTEGER) {
										(yyval.param).value = short_int_evaluate((yyvsp[(1) - (3)].param).value, (yyvsp[(3) - (3)].param).value, (yyvsp[(2) - (3)].num)); (yyval.param).is_expr = 0;
										(yyval.param).is_accsr = 0; (yyval.param).type = EMPTY;
									} 
							 	}
								else {
									struct expression *temp = (struct expression*) malloc (sizeof (struct expression));
									temp->op = (yyvsp[(2) - (3)].num); 
									temp->p_list.list[0] = (yyvsp[(1) - (3)].param); temp->p_list.list[1] = (yyvsp[(3) - (3)].param); 
									(yyval.param).value = (long) temp; (yyval.param).is_name = 0; (yyval.param).is_expr = 1; (yyval.param).is_accsr = 0; (yyval.param).type = EMPTY;
								}}
    break;

  case 39:

/* Line 1455 of yacc.c  */
#line 1553 "coolinary.y"
    {(yyval.param).value = (long) (yyvsp[(1) - (1)].text); (yyval.param).is_name = 1; (yyval.param).is_expr = 0; (yyval.param).is_accsr = 0; (yyval.param).type = EMPTY;}
    break;

  case 40:

/* Line 1455 of yacc.c  */
#line 1554 "coolinary.y"
    {(yyval.param).value = (yyvsp[(1) - (1)].num); (yyval.param).is_name = 0; (yyval.param).is_expr = 0; (yyval.param).is_accsr = 0; (yyval.param).type = INTEGER;}
    break;

  case 41:

/* Line 1455 of yacc.c  */
#line 1555 "coolinary.y"
    {(yyval.param).value = (long) (yyvsp[(1) - (1)].text); (yyval.param).is_name = 0; (yyval.param).is_expr = 0; (yyval.param).is_accsr = 0; (yyval.param).type = CSTRING;}
    break;

  case 42:

/* Line 1455 of yacc.c  */
#line 1556 "coolinary.y"
    {(yyval.param) = (yyvsp[(1) - (1)].param);}
    break;

  case 43:

/* Line 1455 of yacc.c  */
#line 1557 "coolinary.y"
    {(yyval.param) = (yyvsp[(1) - (1)].param);}
    break;

  case 44:

/* Line 1455 of yacc.c  */
#line 1560 "coolinary.y"
    {struct param_list *new = (struct param_list*) malloc (sizeof (struct param_list));
						new->list[0].value = (long) (yyvsp[(1) - (3)].text); new->list[1].value = FNAME; (yyval.param).value = (long) new; (yyval.param).is_accsr = 1;
						(yyval.param).is_name = 0; (yyval.param).is_expr = 0; (yyval.param).type = EMPTY;}
    break;

  case 45:

/* Line 1455 of yacc.c  */
#line 1565 "coolinary.y"
    {struct param_list *new = (struct param_list*) malloc (sizeof (struct param_list));
						new->list[0].value = (long) (yyvsp[(1) - (3)].text); new->list[1].value = FQUANTITY; (yyval.param).value = (long) new; (yyval.param).is_accsr = 1;
						(yyval.param).is_name = 0; (yyval.param).is_expr = 0; (yyval.param).type = EMPTY;}
    break;

  case 46:

/* Line 1455 of yacc.c  */
#line 1568 "coolinary.y"
    {struct param_list *new = (struct param_list*) malloc (sizeof (struct param_list));
						new->list[0].value = (long) (yyvsp[(1) - (3)].text); new->list[1].value = FNUTRITION; (yyval.param).value = (long) new; (yyval.param).is_accsr = 1;
						(yyval.param).is_name = 0; (yyval.param).is_expr = 0; (yyval.param).type = EMPTY;}
    break;

  case 47:

/* Line 1455 of yacc.c  */
#line 1571 "coolinary.y"
    {struct param_list *new = (struct param_list*) malloc (sizeof (struct param_list));
						new->list[0].value = (long) (yyvsp[(1) - (3)].text); new->list[1].value = FTIME; (yyval.param).value = (long) new; (yyval.param).is_accsr = 1;
						(yyval.param).is_name = 0; (yyval.param).is_expr = 0; (yyval.param).type = EMPTY;}
    break;

  case 48:

/* Line 1455 of yacc.c  */
#line 1576 "coolinary.y"
    {(yyval.num) = ADD;}
    break;

  case 49:

/* Line 1455 of yacc.c  */
#line 1577 "coolinary.y"
    {(yyval.num) = SUBTRACT;}
    break;

  case 50:

/* Line 1455 of yacc.c  */
#line 1578 "coolinary.y"
    {(yyval.num) = MULTIPLY;}
    break;

  case 51:

/* Line 1455 of yacc.c  */
#line 1579 "coolinary.y"
    {(yyval.num) = DIVIDE;}
    break;

  case 52:

/* Line 1455 of yacc.c  */
#line 1582 "coolinary.y"
    {(yyval.num) = LTHAN;}
    break;

  case 53:

/* Line 1455 of yacc.c  */
#line 1583 "coolinary.y"
    {(yyval.num) = LTHANE;}
    break;

  case 54:

/* Line 1455 of yacc.c  */
#line 1584 "coolinary.y"
    {(yyval.num) = EQUALS;}
    break;

  case 55:

/* Line 1455 of yacc.c  */
#line 1585 "coolinary.y"
    {(yyval.num) = NEQUALS;}
    break;

  case 56:

/* Line 1455 of yacc.c  */
#line 1586 "coolinary.y"
    {(yyval.num) = GTHANE;}
    break;

  case 57:

/* Line 1455 of yacc.c  */
#line 1587 "coolinary.y"
    {(yyval.num) = GTHAN;}
    break;



/* Line 1455 of yacc.c  */
#line 3356 "y.tab.c"
      default: break;
    }
  YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);

  YYPOPSTACK (yylen);
  yylen = 0;
  YY_STACK_PRINT (yyss, yyssp);

  *++yyvsp = yyval;

  /* Now `shift' the result of the reduction.  Determine what state
     that goes to, based on the state we popped back to and the rule
     number reduced by.  */

  yyn = yyr1[yyn];

  yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
  if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
    yystate = yytable[yystate];
  else
    yystate = yydefgoto[yyn - YYNTOKENS];

  goto yynewstate;


/*------------------------------------.
| yyerrlab -- here on detecting error |
`------------------------------------*/
yyerrlab:
  /* If not already recovering from an error, report this error.  */
  if (!yyerrstatus)
    {
      ++yynerrs;
#if ! YYERROR_VERBOSE
      yyerror (YY_("syntax error"));
#else
      {
	YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
	if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
	  {
	    YYSIZE_T yyalloc = 2 * yysize;
	    if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
	      yyalloc = YYSTACK_ALLOC_MAXIMUM;
	    if (yymsg != yymsgbuf)
	      YYSTACK_FREE (yymsg);
	    yymsg = (char *) YYSTACK_ALLOC (yyalloc);
	    if (yymsg)
	      yymsg_alloc = yyalloc;
	    else
	      {
		yymsg = yymsgbuf;
		yymsg_alloc = sizeof yymsgbuf;
	      }
	  }

	if (0 < yysize && yysize <= yymsg_alloc)
	  {
	    (void) yysyntax_error (yymsg, yystate, yychar);
	    yyerror (yymsg);
	  }
	else
	  {
	    yyerror (YY_("syntax error"));
	    if (yysize != 0)
	      goto yyexhaustedlab;
	  }
      }
#endif
    }



  if (yyerrstatus == 3)
    {
      /* If just tried and failed to reuse lookahead token after an
	 error, discard it.  */

      if (yychar <= YYEOF)
	{
	  /* Return failure if at end of input.  */
	  if (yychar == YYEOF)
	    YYABORT;
	}
      else
	{
	  yydestruct ("Error: discarding",
		      yytoken, &yylval);
	  yychar = YYEMPTY;
	}
    }

  /* Else will try to reuse lookahead token after shifting the error
     token.  */
  goto yyerrlab1;


/*---------------------------------------------------.
| yyerrorlab -- error raised explicitly by YYERROR.  |
`---------------------------------------------------*/
yyerrorlab:

  /* Pacify compilers like GCC when the user code never invokes
     YYERROR and the label yyerrorlab therefore never appears in user
     code.  */
  if (/*CONSTCOND*/ 0)
     goto yyerrorlab;

  /* Do not reclaim the symbols of the rule which action triggered
     this YYERROR.  */
  YYPOPSTACK (yylen);
  yylen = 0;
  YY_STACK_PRINT (yyss, yyssp);
  yystate = *yyssp;
  goto yyerrlab1;


/*-------------------------------------------------------------.
| yyerrlab1 -- common code for both syntax error and YYERROR.  |
`-------------------------------------------------------------*/
yyerrlab1:
  yyerrstatus = 3;	/* Each real token shifted decrements this.  */

  for (;;)
    {
      yyn = yypact[yystate];
      if (yyn != YYPACT_NINF)
	{
	  yyn += YYTERROR;
	  if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
	    {
	      yyn = yytable[yyn];
	      if (0 < yyn)
		break;
	    }
	}

      /* Pop the current state because it cannot handle the error token.  */
      if (yyssp == yyss)
	YYABORT;


      yydestruct ("Error: popping",
		  yystos[yystate], yyvsp);
      YYPOPSTACK (1);
      yystate = *yyssp;
      YY_STACK_PRINT (yyss, yyssp);
    }

  *++yyvsp = yylval;


  /* Shift the error token.  */
  YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);

  yystate = yyn;
  goto yynewstate;


/*-------------------------------------.
| yyacceptlab -- YYACCEPT comes here.  |
`-------------------------------------*/
yyacceptlab:
  yyresult = 0;
  goto yyreturn;

/*-----------------------------------.
| yyabortlab -- YYABORT comes here.  |
`-----------------------------------*/
yyabortlab:
  yyresult = 1;
  goto yyreturn;

#if !defined(yyoverflow) || YYERROR_VERBOSE
/*-------------------------------------------------.
| yyexhaustedlab -- memory exhaustion comes here.  |
`-------------------------------------------------*/
yyexhaustedlab:
  yyerror (YY_("memory exhausted"));
  yyresult = 2;
  /* Fall through.  */
#endif

yyreturn:
  if (yychar != YYEMPTY)
     yydestruct ("Cleanup: discarding lookahead",
		 yytoken, &yylval);
  /* Do not reclaim the symbols of the rule which action triggered
     this YYABORT or YYACCEPT.  */
  YYPOPSTACK (yylen);
  YY_STACK_PRINT (yyss, yyssp);
  while (yyssp != yyss)
    {
      yydestruct ("Cleanup: popping",
		  yystos[*yyssp], yyvsp);
      YYPOPSTACK (1);
    }
#ifndef yyoverflow
  if (yyss != yyssa)
    YYSTACK_FREE (yyss);
#endif
#if YYERROR_VERBOSE
  if (yymsg != yymsgbuf)
    YYSTACK_FREE (yymsg);
#endif
  /* Make sure YYID is used.  */
  return YYID (yyresult);
}



